summaryrefslogtreecommitdiff
path: root/GPG-KEY
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-09-11 00:12:31 +0200
committerMark Wielaard <mark@klomp.org>2017-09-20 20:43:48 +0200
commitb10d7eb74064c5906f031cd17c0f82041c6a4ca1 (patch)
treed5b24dadaad6a8747877e2dd111fcce88e668284 /GPG-KEY
parent04ecad6acd13e7120b171307aa57325b2ec08715 (diff)
downloadelfutils-b10d7eb74064c5906f031cd17c0f82041c6a4ca1.tar.gz
ar: Check whether ar header values fit.
When compiling with -O3 gcc finds an interesting error: src/ar.c: In function ‘do_oper_insert’: src/ar.c:1077:56: error: ‘%-*ld’ directive output may be truncated writing between 6 and 10 bytes into a region of size 7 [-Werror=format-truncation=] snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val); ^~~~~ The problem is that the ar header values have to fit in a limited (not zero terminated) string. We should check the snprintf return value to see if the values are representable. Also make ar valgrind and ubsan clean and add a minimal sanity test. Reported-by: Matthias Klose <doko@ubuntu.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'GPG-KEY')
0 files changed, 0 insertions, 0 deletions