Skip to content

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

Open
michaelortmann wants to merge 1 commit into
eggheads:developfrom
michaelortmann:uptime.Wformat-overflow
Open

Minimal fix for Wformat-overflow, because #548 is postponed#1667
michaelortmann wants to merge 1 commit into
eggheads:developfrom
michaelortmann:uptime.Wformat-overflow

Conversation

@michaelortmann
Copy link
Copy Markdown
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