From ac917deba6f02a0a2454c21059de306c3fc248f1 Mon Sep 17 00:00:00 2001 From: bde Date: Sat, 21 Jan 1995 10:24:18 +0000 Subject: Use exactly the same checks in excluded() as in inlist(): ignore stabs and stringless symbols in excluded(); check for too-small (nonzero) string table offsets in inlist(). --- usr.bin/symorder/symorder.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'usr.bin/symorder/symorder.c') diff --git a/usr.bin/symorder/symorder.c b/usr.bin/symorder/symorder.c index f2f4ef2..3644312 100644 --- a/usr.bin/symorder/symorder.c +++ b/usr.bin/symorder/symorder.c @@ -267,14 +267,10 @@ inlist(p) register char *nam; register struct nlist *op; - if (p->n_type & N_STAB) + if (p->n_type & N_STAB || p->n_un.n_strx == 0) return (-1); - if (p->n_un.n_strx == 0) - return (-1); - - if (p->n_un.n_strx >= strtabsize) + if (p->n_un.n_strx < sizeof(int) || p->n_un.n_strx >= strtabsize) badfmt("corrupted symbol table"); - nam = &strings[p->n_un.n_strx - sizeof(int)]; for (op = &order[nsym]; --op >= order; ) { if (strcmp(op->n_un.n_name, nam) != 0) @@ -291,6 +287,8 @@ excluded(p) register char *nam; register int x; + if (p->n_type & N_STAB || p->n_un.n_strx == 0) + return (0); if (p->n_un.n_strx < sizeof(int) || p->n_un.n_strx >= strtabsize) badfmt("corrupted symbol table"); nam = &strings[p->n_un.n_strx - sizeof(int)]; -- cgit v1.1