summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2002-09-09 15:51:10 +0000
committerrobert <robert@FreeBSD.org>2002-09-09 15:51:10 +0000
commit21c03c95c89c64ca3511f397ae3c616cc7ad03b6 (patch)
treed6d6814bfe2498fa4c2217775ed1ff15f1900bdd /sys/i386/ibcs2
parentbdb08fa9d19da90ff90e0b5e8da07ad1cfef1213 (diff)
downloadFreeBSD-src-21c03c95c89c64ca3511f397ae3c616cc7ad03b6.zip
FreeBSD-src-21c03c95c89c64ca3511f397ae3c616cc7ad03b6.tar.gz
- Fix iBCS2 emulation of COFF files that have multiple libraries
in their library (STYP_LIB) section. - Attempt to make the code which calculates the next entry and string offsets look clearer. PR: kern/42580 Tested by: Olaf Klein <ok@adimus.de> (on 4.7-PRERELEASE)
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/imgact_coff.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index 0e5363e..8cf4475 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -389,11 +389,15 @@ exec_coff_imgact(imgp)
M_TEMP, M_WAITOK);
strcpy(libbuf, ibcs2_emul_path);
- for (j = off; j < scns[i].s_size + off; j++) {
+ for (j = off; j < scns[i].s_size + off;) {
+ long stroff, nextoff;
char *libname;
- libname = buf + j + 4 * *(long*)(buf + j + 4);
- j += 4* *(long*)(buf + j);
+ nextoff = 4 * *(long *)(buf + j);
+ stroff = 4 * *(long *)(buf + j + sizeof(long));
+
+ libname = buf + j + stroff;
+ j += nextoff;
DPRINTF(("%s(%d): shared library %s\n",
__FILE__, __LINE__, libname));
OpenPOWER on IntegriCloud