Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal fix for Wformat-overflow, because #548 is postponed #1667

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Aug 1, 2024

Found by:
Patch by: michaelortmann
Fixes:

One-line summary:
Minimal fix for Wformat-overflow, because #548 is postponed

Additional description (if needed):
No change to raw uptime packet len and content

Test cases demonstrating functionality (if applicable):
Fixes following compiler warning:

gcc -fPIC -g -O2 -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod  -DHAVE_CONFIG_H -I/usr/include -Og -g3 -DDEBUG -fsanitize=address -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS  -DMAKING_MODS -c .././uptime.mod/uptime.c && mv -f uptime.o ../
.././uptime.mod/uptime.c: In function ‘send_uptime’:
.././uptime.mod/uptime.c:223:3: warning: ‘%s’ directive writing up to 323 bytes into a region of size 2 [-Wformat-overflow=]
  223 |   printf("DEBUG: %i %i\n", len, sprintf(mem->string, "%s %s %s", botnetnick, servhost, uptime_version));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.././uptime.mod/uptime.c:223:3: note: ‘sprintf’ output 3 or more bytes (assuming 373) into a destination of size 3

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