Skip to content

Commit

Permalink
src/log.c: bump XXDLEN 16->32 to ensure buffer isn't too small
Browse files Browse the repository at this point in the history
GCC 8 and GCC 9 both are uncomfortable with the snprintf'ing
of format string "%04zu: %02x" fitting into 16 bytes,
and it's unclear to me this is an unwarranted concern.

If the buffer is indeed too small, the result would not
be a memory safety error AFAIK but the truncated string
would provide poor log messages.

Likely harmless but instead of worrying about any of that
just allocate a few more bytes to make it clear to programmers and
compilers alike that there's nothing to worry about.
  • Loading branch information
dtzWill authored and martelletto committed Jan 23, 2020
1 parent 7569edf commit 9d14b7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#ifndef FIDO_NO_DIAGNOSTIC

#define XXDLEN 16
#define XXDLEN 32
#define XXDROW 128
#define LINELEN 256

Expand Down

0 comments on commit 9d14b7a

Please sign in to comment.