Skip to content

fix: replace unsafe int-to-pointer cast in SiCalledDeleteIpTable#4

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-build-warning
Draft

fix: replace unsafe int-to-pointer cast in SiCalledDeleteIpTable#4
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-build-warning

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 22, 2026

SiCalledDeleteIpTable was casting a UINT key directly to IP_TABLE_ENTRY *, producing a -Wint-to-pointer-cast warning on 64-bit targets where pointers are wider than 32 bits.

Changes

  • src/Cedar/Server.c: Replace IsInList(h->IpTable, (void *)key) + (IP_TABLE_ENTRY *)key with the proper IsInListKey / ListKeyToPointer API — the same pattern already used in StDeleteIpTable (Admin.c) for the identical operation.
// Before
if (IsInList(h->IpTable, (void *)key))
{
    IP_TABLE_ENTRY *e = (IP_TABLE_ENTRY *)key;

// After
if (IsInListKey(h->IpTable, key))
{
    IP_TABLE_ENTRY *e = ListKeyToPointer(h->IpTable, key);
Original prompt

This section details on the original issue you should resolve

<issue_title>fix build warning</issue_title>
<issue_description>we need to fix the following warning

2026-02-22T17:21:26.8782564Z /home/runner/work/SoftEtherVPN/SoftEtherVPN/src/Cedar/Server.c:7775:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2026-02-22T17:21:26.8783710Z  7775 |                         IP_TABLE_ENTRY *e = (IP_TABLE_ENTRY *)key;
2026-02-22T17:21:26.8784213Z       |             
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ter in SiCalledDeleteIpTable

Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build warning in Server.c fix: replace unsafe int-to-pointer cast in SiCalledDeleteIpTable Feb 22, 2026
Copilot AI requested a review from chipitsine February 22, 2026 17:50
@chipitsine chipitsine requested a review from Copilot February 22, 2026 18:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a compiler warning caused by an unsafe integer-to-pointer cast in SiCalledDeleteIpTable that occurs on 64-bit platforms where pointers are wider than 32-bit integers.

Changes:

  • Updated SiCalledDeleteIpTable to use the proper IsInListKey and ListKeyToPointer API functions instead of direct casting
  • Aligns the implementation with the pattern already used in StDeleteIpTable for identical operations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Cedar/Server.c Replaced unsafe (void *)key and (IP_TABLE_ENTRY *)key casts with IsInListKey and ListKeyToPointer API calls
_codeql_detected_source_root CodeQL configuration file addition (unrelated to the fix)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix build warning

3 participants