aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2018-12-28 22:47:55 +0000
committerEd Maste <emaste@FreeBSD.org>2018-12-28 22:47:55 +0000
commitac8e938122706537a27556f0ad55d8fa55106e44 (patch)
tree04485a8baefccf2344347036138fedbe7ed47bc4 /usr.bin
parent557a5ad425f56350b199a430e426c846e6695de5 (diff)
downloadsrc-ac8e938122706537a27556f0ad55d8fa55106e44.tar.gz
src-ac8e938122706537a27556f0ad55d8fa55106e44.zip
ar: detect and error out on 32-bit symbol table overflow
BSD ar currently does not support the /SYM64/ 64-bit symbol table, and previously truncated to 32-bits, silently producing corrupted archives larger than 4GB. This is another overflow case in addtion to r342575. PR: 234454 Reported by: Aijaz Baig, imp MFC after: 2 weeks MFC with: r342575 Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=342580
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ar/write.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/ar/write.c b/usr.bin/ar/write.c
index 6780c652189e..f57d14a5161e 100644
--- a/usr.bin/ar/write.c
+++ b/usr.bin/ar/write.c
@@ -628,6 +628,9 @@ write_objs(struct bsdar *bsdar)
if (strlen(obj->name) > _MAXNAMELEN_SVR4)
add_to_ar_str_table(bsdar, obj->name);
bsdar->rela_off += _ARHDR_LEN + obj->size + obj->size % 2;
+ if (bsdar->rela_off > UINT32_MAX)
+ bsdar_errc(bsdar, EX_SOFTWARE, 0,
+ "Symbol table offset overflow");
}
/*