From 8ea05a7c1358dd9820e376937b619eb140b8e3d3 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 1 Mar 2001 06:03:17 +0000 Subject: MAXPATHLEN includes the trailing NUL. Correct array sizes to reflect this. Correct NUL termination after strncpy. # Didn't to strncpy -> strlcpy change. --- usr.bin/make/arch.c | 4 ++-- usr.bin/make/main.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'usr.bin/make') diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index a3a2a6a..a842577 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -478,7 +478,7 @@ ArchStatMember (archive, member, hash) Arch *ar; /* Archive descriptor */ Hash_Entry *he; /* Entry containing member's description */ struct ar_hdr arh; /* archive-member header for reading archive */ - char memName[MAXPATHLEN+1]; + char memName[MAXPATHLEN]; /* Current member name while hashing. */ /* @@ -760,7 +760,7 @@ ArchSVR4Entry(ar, name, size, arch) } (void) strncpy(name, &ar->fnametab[entry], MAXPATHLEN); - name[MAXPATHLEN] = '\0'; + name[MAXPATHLEN - 1] = '\0'; return 1; } #endif diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 8ff1de3..dc8c8c8 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -467,9 +467,9 @@ main(argc, argv) struct stat sb; char *pwd; #endif - char mdpath[MAXPATHLEN + 1]; - char obpath[MAXPATHLEN + 1]; - char cdpath[MAXPATHLEN + 1]; + char mdpath[MAXPATHLEN]; + char obpath[MAXPATHLEN]; + char cdpath[MAXPATHLEN]; char *machine = getenv("MACHINE"); char *machine_arch = getenv("MACHINE_ARCH"); char *machine_cpu = getenv("MACHINE_CPU"); @@ -936,7 +936,7 @@ ReadMakefile(p, q) char *fname = p; /* makefile to read */ extern Lst parseIncPath; FILE *stream; - char *name, path[MAXPATHLEN + 1]; + char *name, path[MAXPATHLEN]; if (!strcmp(fname, "-")) { Parse_File("(stdin)", stdin); -- cgit v1.1