summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-06-28 21:36:06 +0000
committerEric Andersen <andersen@codepoet.org>2001-06-28 21:36:06 +0000
commit66ca9480c8878285af3c1fceb526d592d1390579 (patch)
tree2b640e10145f4279c333cf8feff48c3a293015b0 /modutils
parent029b4a04221794101812407f5c60155bdfdd1481 (diff)
downloadbusybox-w32-66ca9480c8878285af3c1fceb526d592d1390579.tar.gz
busybox-w32-66ca9480c8878285af3c1fceb526d592d1390579.tar.bz2
busybox-w32-66ca9480c8878285af3c1fceb526d592d1390579.zip
Fix a nasty hard to spot bug found by Ralph Siemsen <ralphs@netwinder.org>.
This would cause it to obliterates the end of the strtab section, so symbol lookups would fail and then it would crash. Ugh. This should fix things for people having trouble with insmod.
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 71f76c750..4b0051594 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -130,7 +130,7 @@
130#ifndef MODUTILS_MODULE_H 130#ifndef MODUTILS_MODULE_H
131static const int MODUTILS_MODULE_H = 1; 131static const int MODUTILS_MODULE_H = 1;
132 132
133#ident "$Id: insmod.c,v 1.66 2001/06/19 15:00:52 andersen Exp $" 133#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
134 134
135/* This file contains the structures used by the 2.0 and 2.1 kernels. 135/* This file contains the structures used by the 2.0 and 2.1 kernels.
136 We do not use the kernel headers directly because we do not wish 136 We do not use the kernel headers directly because we do not wish
@@ -347,7 +347,7 @@ int delete_module(const char *);
347#ifndef MODUTILS_OBJ_H 347#ifndef MODUTILS_OBJ_H
348static const int MODUTILS_OBJ_H = 1; 348static const int MODUTILS_OBJ_H = 1;
349 349
350#ident "$Id: insmod.c,v 1.66 2001/06/19 15:00:52 andersen Exp $" 350#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
351 351
352/* The relocatable object is manipulated using elfin types. */ 352/* The relocatable object is manipulated using elfin types. */
353 353
@@ -1460,8 +1460,13 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
1460 f->symtab[hash] = sym; 1460 f->symtab[hash] = sym;
1461 sym->ksymidx = -1; 1461 sym->ksymidx = -1;
1462 1462
1463 if (ELFW(ST_BIND) (info) == STB_LOCAL) 1463 if (ELFW(ST_BIND)(info) == STB_LOCAL && symidx != -1) {
1464 f->local_symtab[symidx] = sym; 1464 if (symidx >= f->local_symtab_size)
1465 error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld",
1466 name, (long) symidx, (long) f->local_symtab_size);
1467 else
1468 f->local_symtab[symidx] = sym;
1469 }
1465 1470
1466 found: 1471 found:
1467 sym->name = name; 1472 sym->name = name;