summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2019-02-18 17:30:41 +0000
committerChristos Zoulas <christos@zoulas.com>2019-02-18 17:30:41 +0000
commit94b7501f48e134e77716e7ebefc73d6bbe72ba55 (patch)
tree168be3eec7c5cae4023ecd34213cb7e0611c4bd5
parent264878fd9de442aec81a46bf014dd7690a90e483 (diff)
downloadfile-git-94b7501f48e134e77716e7ebefc73d6bbe72ba55.tar.gz
PR/62: spinpx: Avoid non-nul-terminated string read.
-rw-r--r--src/readelf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 7086f7f0..519811d1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.159 2019/02/01 17:58:48 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.160 2019/02/18 17:30:41 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -566,8 +566,8 @@ do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
}
if (namesz == 4 && strcmp((char *)&nbuf[noff], "Go") == 0 &&
type == NT_GO_BUILD_ID && descsz < 128) {
- if (file_printf(ms, ", Go BuildID=%s",
- (char *)&nbuf[doff]) == -1)
+ if (file_printf(ms, ", Go BuildID=%.*s",
+ CAST(int, descsz), CAST(char *, &nbuf[doff])) == -1)
return -1;
return 1;
}