From d023663b4b6c75cdc941132aa4c34b0194aa8a36 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Wed, 9 Jun 2010 18:44:48 +0430 Subject: [PATCH] die if too many objs or secs --- ld.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ld.c b/ld.c index 610db83..3dfadad 100644 --- a/ld.c +++ b/ld.c @@ -347,12 +347,16 @@ static void outelf_add(struct outelf *oe, char *mem) int i; if (ehdr->e_type != ET_REL) return; + if (oe->nobjs >= MAXOBJS) + die("ld: MAXOBJS reached!\n"); obj = &oe->objs[oe->nobjs++]; obj_init(obj, mem); for (i = 0; i < ehdr->e_shnum; i++) { struct secmap *sec; if (!(shdr[i].sh_flags & 0x7)) continue; + if (oe->nsecs >= MAXSECS) + die("ld: MAXSECS reached\n"); sec = &oe->secs[oe->nsecs++]; sec->o_shdr = &shdr[i]; sec->obj = obj; -- 2.11.4.GIT