mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Fix a bug that would truncate the full name of an archive member if
the length of happens to be larger than MAXPATHLEN. PR: bin/74368 Submitted by: Max Okumoto <okumoto@ucsd.edu> Obtained from: DragonFlyBSD
This commit is contained in:
parent
fdec55d6b5
commit
617a8c57ad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138196
@ -342,14 +342,17 @@ Arch_ParseArchive (char **linePtr, Lst nodeLst, GNode *ctxt)
|
||||
char *member;
|
||||
size_t sz = MAXPATHLEN;
|
||||
size_t nsz;
|
||||
|
||||
nameBuf = emalloc(sz);
|
||||
|
||||
Dir_Expand(memName, dirSearchPath, members);
|
||||
while (!Lst_IsEmpty(members)) {
|
||||
member = (char *)Lst_DeQueue(members);
|
||||
nsz = strlen(libName) + strlen(member) + 3;
|
||||
if (sz > nsz)
|
||||
nameBuf = erealloc(nameBuf, sz = nsz * 2);
|
||||
if (nsz > sz) {
|
||||
sz = nsz * 2;
|
||||
nameBuf = erealloc(nameBuf, sz);
|
||||
}
|
||||
|
||||
snprintf(nameBuf, sz, "%s(%s)", libName, member);
|
||||
free(member);
|
||||
|
Loading…
Reference in New Issue
Block a user