MAXPATHLEN includes the trailing NUL.
Correct array sizes to reflect this. Correct NUL termination after strncpy. # Didn't to strncpy -> strlcpy change.
This commit is contained in:
parent
77892acd6a
commit
20b367cea1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=73262
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user