diff options
author | ache <ache@FreeBSD.org> | 1994-12-17 05:59:33 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-12-17 05:59:33 +0000 |
commit | 615440cdedfc39ddc3e7a02e3f02ffbaf0427b70 (patch) | |
tree | 764a2db659f330852b5cd1d739919252964e1a91 | |
parent | 18911700cc959aae21b22c88e41b67c3a7d2000f (diff) | |
download | FreeBSD-src-615440cdedfc39ddc3e7a02e3f02ffbaf0427b70.zip FreeBSD-src-615440cdedfc39ddc3e7a02e3f02ffbaf0427b70.tar.gz |
Fix odd length long names
Submitted by: dufault@hda.com
also Obtained from: 1.1.5.1
-rw-r--r-- | usr.bin/ar/archive.c | 3 | ||||
-rw-r--r-- | usr.bin/ar/misc.c | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/ar/archive.c b/usr.bin/ar/archive.c index 2d31b2f..8a6fe2f 100644 --- a/usr.bin/ar/archive.c +++ b/usr.bin/ar/archive.c @@ -299,7 +299,8 @@ copy_ar(cfp, size) error(cfp->rname); } - if (cfp->flags & RPAD && size & 1 && (nr = read(from, buf, 1)) != 1) { + if (cfp->flags & RPAD && (size + chdr.lname) & 1 && + (nr = read(from, buf, 1)) != 1) { if (nr == 0) badfmt(); error(cfp->rname); diff --git a/usr.bin/ar/misc.c b/usr.bin/ar/misc.c index d182fa9..4faaa22 100644 --- a/usr.bin/ar/misc.c +++ b/usr.bin/ar/misc.c @@ -126,10 +126,8 @@ int compare(dest) char *dest; { - - if (options & AR_TR) - return (!strncmp(chdr.name, rname(dest), OLDARMAXNAME)); - return (!strcmp(chdr.name, rname(dest))); + int maxname = (options & AR_TR) ? OLDARMAXNAME : MAXNAMLEN; + return (!strncmp(chdr.name, rname(dest), maxname)); } void |