FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix signedness & buffer handling warnings in tcpip.cc by emile-ross · Pull Request #3395 · nmap/nmap · GitHub

/ nmap Public

Fix signedness & buffer handling warnings in tcpip.cc - #3395

Open
emile-ross wants to merge 3 commits into
nmap:masterfrom
emile-ross:master
Open

Fix signedness & buffer handling warnings in tcpip.cc#3395
emile-ross wants to merge 3 commits into
nmap:masterfrom
emile-ross:master

Conversation

Copy link
Copy Markdown

Replace strncpy() with inet_ntop() and fix signedness warning

  • Use inet_ntop(AF_INET, &bullshit, sourcehost, sizeof(sourcehost))
    instead of strncpy() for safer buffer handling.

  • Cast tcplen to size_t in assert() function call to resolve the -Wsign-compare warning.

emile-ross and others added 3 commits June 22, 2026 03:09
Replace strncpy() with inet_ntop() to prevent potential truncation
Cast tcplen to size_t to resolve signedness comparison warning.

Changes:
- Use ``inet_ntop(AF_INET, &bullshit, sourcehost, sizeof(sourcehost))``
  instead of ``strncpy(sourcehost, inet_ntoa(bullshit), 16)`` to ensure
string termination
- Cast tcplen to size_t in assert
```c
assert((size_t)tcplen >= sizeof(tcp))
```
to remove the -Wsign-compare warning

This removes compiler warnings and improves code safety.

Copy link
Copy Markdown
Author

The cast has just been fixed by another pr but the inet_ntop(AF_INET, &bullshit, sourcehost, sizeof(sourcehost)) is still not fixed

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

1 participant


Back | FazBrowse Home | New Git URL