summaryrefslogtreecommitdiffstats
path: root/usr.bin/ctfconv/ctfconv.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2017-09-29 16:05:53 +0000
committerjsg <jsg@openbsd.org>2017-09-29 16:05:53 +0000
commitbe9aadfacfc45dac92e962c697836a1ffb5455e0 (patch)
tree234c5d1935e91fece8dfcad9468308cdade4afdb /usr.bin/ctfconv/ctfconv.c
parentSPI values 0-255 are reserved, so change the example to use a valid one. (diff)
downloadwireguard-openbsd-be9aadfacfc45dac92e962c697836a1ffb5455e0.tar.xz
wireguard-openbsd-be9aadfacfc45dac92e962c697836a1ffb5455e0.zip
Check that the end of sections do not exceed the filesize for both
symtab and sections. Corrects behaviour that led to crashes found via afl. ok mpi@
Diffstat (limited to 'usr.bin/ctfconv/ctfconv.c')
-rw-r--r--usr.bin/ctfconv/ctfconv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ctfconv/ctfconv.c b/usr.bin/ctfconv/ctfconv.c
index 050b74ec8b5..06891784ed8 100644
--- a/usr.bin/ctfconv/ctfconv.c
+++ b/usr.bin/ctfconv/ctfconv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctfconv.c,v 1.11 2017/09/29 09:30:42 mpi Exp $ */
+/* $OpenBSD: ctfconv.c,v 1.12 2017/09/29 16:05:53 jsg Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
@@ -59,7 +59,7 @@ void dump_obj(struct itype *, int *);
/* elf.c */
int iself(const char *, size_t);
int elf_getshstab(const char *, size_t, const char **, size_t *);
-ssize_t elf_getsymtab(const char *, const char *, size_t,
+ssize_t elf_getsymtab(const char *, size_t, const char *, size_t,
const Elf_Sym **, size_t *);
ssize_t elf_getsection(char *, size_t, const char *, const char *,
size_t, const char **, size_t *);
@@ -222,7 +222,7 @@ elf_convert(char *p, size_t filesize)
return 1;
/* Find symbol table location and number of symbols. */
- if (elf_getsymtab(p, shstab, shstabsz, &symtab, &nsymb) == -1)
+ if (elf_getsymtab(p, filesize, shstab, shstabsz, &symtab, &nsymb) == -1)
warnx("symbol table not found");
/* Find string table location and size. */