Skip to content

Commit

Permalink
Fix SIGSEGV/stacksmash in UDP logger.
Browse files Browse the repository at this point in the history
The bug was reported in #197. Caused by insufficient size of logging
buffer.
  • Loading branch information
Waujito committed Dec 1, 2024
1 parent fd1ae1e commit aefabe7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@ int process_udp_packet(const struct section_config_t *section, const uint8_t *pk
goto accept;
}

if (dlen > 10 && config.verbose >= VERBOSE_TRACE) {
char buf[50];
char *bufpt = buf;
if (dlen > 10 && config.verbose == VERBOSE_TRACE) {
char logging_buf[128];
char *bufpt = logging_buf;
bufpt += sprintf(bufpt, "UDP payload start: [ ");
for (int i = 0; i < 10; i++) {
bufpt += sprintf(bufpt, "%02x ", data[i]);
}
bufpt += sprintf(bufpt, "]");
lgtrace_addp("%s", buf);
lgtrace_addp("%s", logging_buf);
}


Expand Down

0 comments on commit aefabe7

Please sign in to comment.