diff options
author | harti <harti@FreeBSD.org> | 2004-11-29 16:23:34 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2004-11-29 16:23:34 +0000 |
commit | 8ebdc3e0c2ef23fa7f882272f2b37a0a32b12dca (patch) | |
tree | fdd35354a8096f89c0aa816c883a9a4e84c0c757 /usr.bin/make | |
parent | ed61f3b982acfe4d274bbe06dac6d177cd71efbb (diff) | |
download | FreeBSD-src-8ebdc3e0c2ef23fa7f882272f2b37a0a32b12dca.zip FreeBSD-src-8ebdc3e0c2ef23fa7f882272f2b37a0a32b12dca.tar.gz |
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
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/arch.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index e79d383..1513431 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -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); |