summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-01-28 07:18:09 +0000
committermidipix <writeonce@midipix.org>2024-01-28 07:31:13 +0000
commitb342fcb10835062f43fb6f41ce7bed8cefc69e78 (patch)
treeca085c2271130a2f456dca867f37174ee2b141ec
parent3eae8295611985639272d5f0fe6c1d9dec6dfa09 (diff)
downloadslibtool-b342fcb10835062f43fb6f41ce7bed8cefc69e78.tar.bz2
slibtool-b342fcb10835062f43fb6f41ce7bed8cefc69e78.tar.xz
slbt_ar_parse_primary_armap_bsd_64(): account for data past the string table.
-rw-r--r--src/arbits/slbt_archive_meta.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/arbits/slbt_archive_meta.c b/src/arbits/slbt_archive_meta.c
index 108cb5d..5bc1c2f 100644
--- a/src/arbits/slbt_archive_meta.c
+++ b/src/arbits/slbt_archive_meta.c
@@ -444,8 +444,8 @@ static int slbt_ar_parse_primary_armap_bsd_64(
sizeofstrs = u64_lo + (u64_hi << 32);
m->symstrs = (const char *)mark;
- cap = memberp->ar_object_data;
- cap += memberp->ar_object_size;
+ cap = m->symstrs;
+ cap += sizeofstrs;
if ((cap == m->symstrs) && nsyms)
return SLBT_CUSTOM_ERROR(
@@ -463,7 +463,7 @@ static int slbt_ar_parse_primary_armap_bsd_64(
dctx,
SLBT_ERR_AR_INVALID_ARMAP_STRING_TABLE);
- if (!ch[0] && ch[-1])
+ if (!ch[0] && ch[-1] && (nstrs < nsyms))
nstrs++;
}
@@ -472,11 +472,6 @@ static int slbt_ar_parse_primary_armap_bsd_64(
dctx,
SLBT_ERR_AR_INVALID_ARMAP_STRING_TABLE);
- if (cap[-1])
- return SLBT_CUSTOM_ERROR(
- dctx,
- SLBT_ERR_AR_INVALID_ARMAP_STRING_TABLE);
-
if (!(m->symstrv = calloc(nsyms + 1,sizeof(const char *))))
return SLBT_SYSTEM_ERROR(dctx,0);