Skip to content

Bound the node IP copy to the mNodeIp buffer - #134

Merged
fnordspace merged 1 commit into
qubic:mainfrom
parthod0x:fix/nodeip-and-url-buffer-overflows
Oct 20, 2026
Merged

fnordspace merged 1 commit into
qubic:mainfrom
parthod0x:fix/nodeip-and-url-buffer-overflows

Conversation

@parthod0x

@parthod0x parthod0x commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

The QubicConnection constructor copied strlen(nodeIp) bytes into the 32-byte mNodeIp with no bound, so a node address longer than 31 chars (e.g. a full IPv6 string) overran the buffer. Copy at most 31 bytes and keep the trailing null.

Per review, the earlier proposal.cpp URL change was dropped (that size is already checked upstream). Rebased onto current main; the config-file seed/node_ip bounds landed separately in #133.

@fnordspace fnordspace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. Looks good. However the change in proposal.cpp is not needed since the size is already check on earlier. Please drop this change from the PR and adjust the description.

The QubicConnection constructor memcpy'd strlen(nodeIp) bytes into the
32-byte mNodeIp without a bound, so a node address longer than 31 chars
(e.g. a full IPv6 string) overran the buffer. Copy at most 31 bytes and
keep the trailing null terminator.
@parthod0x
parthod0x force-pushed the fix/nodeip-and-url-buffer-overflows branch from 49c183a to 5f93351 Compare October 15, 2026 18:18
@parthod0x

Copy link
Copy Markdown
Contributor Author

Dropped the proposal.cpp change as requested — the URL size is already checked earlier. The PR is now just the mNodeIp bound in connection.cpp. Rebased onto current main and updated the description. Compiles clean under /WX. Thanks!

@parthod0x parthod0x changed the title Bound node IP and proposal URL copies to their buffer sizes Bound the node IP copy to the mNodeIp buffer Oct 15, 2026
@fnordspace
fnordspace merged commit 96364d7 into qubic:main Oct 20, 2026
3 checks passed
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.

2 participants