diff options
author | Tim Kientzle <kientzle@acm.org> | 2018-12-15 10:40:38 -0800 |
---|---|---|
committer | Tim Kientzle <kientzle@acm.org> | 2018-12-15 10:40:38 -0800 |
commit | 0b91cc42050e6708a5599c6c9474314615ebd22f (patch) | |
tree | 3ea1d6a000de6bc8f0b35c4cc6fd83fced810d03 /build/autogen.sh | |
parent | cef97307a3f681fcbb2cc02db6df3619a3f8b69c (diff) | |
download | libarchive-Issue1104.tar.gz |
Issue 1104: Explicitly limit the printed string to 12 charactersIssue1104
GCC8 tries to diagnose `snprintf()` overflows but isn't quite
smart enough for this case, so emits a false-positive warning.
Remember that `%12s` only specifies the minimum number of bytes. GCC8
conservatively assumes this might result in writing the full length of
`date2`. (Which will never be longer than 12 bytes, but GCC8
apparently can't reason about `strftime` format specifiers yet.)
Changing the specifier here to `%12.12s` explicitly truncates to 12
bytes and should help the compiler understand that this will never
overflow.
While I'm here, correct a minor typo in the previous line; it used
`sizeof(date)` instead of `sizeof(date2)`. (Both are the same
size, so this had no functional impact.)
Diffstat (limited to 'build/autogen.sh')
0 files changed, 0 insertions, 0 deletions