diff options
author | midipix <writeonce@midipix.org> | 2024-01-28 07:16:12 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-01-28 07:31:09 +0000 |
commit | 3eae8295611985639272d5f0fe6c1d9dec6dfa09 (patch) | |
tree | dc3975e832a4a628fdf9833aafbab9ec5bf8e7cb | |
parent | 29c5878fdd773245c8ec78f48053e5110362b445 (diff) | |
download | slibtool-3eae8295611985639272d5f0fe6c1d9dec6dfa09.tar.bz2 slibtool-3eae8295611985639272d5f0fe6c1d9dec6dfa09.tar.xz |
slbt_ar_parse_primary_armap_bsd_32(): account for data past the string table.
-rw-r--r-- | src/arbits/slbt_archive_meta.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/arbits/slbt_archive_meta.c b/src/arbits/slbt_archive_meta.c index f70ee43..108cb5d 100644 --- a/src/arbits/slbt_archive_meta.c +++ b/src/arbits/slbt_archive_meta.c @@ -304,8 +304,8 @@ static int slbt_ar_parse_primary_armap_bsd_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( @@ -323,7 +323,7 @@ static int slbt_ar_parse_primary_armap_bsd_32( dctx, SLBT_ERR_AR_INVALID_ARMAP_STRING_TABLE); - if (!ch[0] && ch[-1]) + if (!ch[0] && ch[-1] && (nstrs < nsyms)) nstrs++; } @@ -332,11 +332,6 @@ static int slbt_ar_parse_primary_armap_bsd_32( 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); |