off by one error in path size check

This commit is contained in:
Todd C. Miller
1996-11-14 00:04:11 +00:00
parent 6798768867
commit aa54c845ed

View File

@@ -160,8 +160,7 @@ char * find_path(file)
/*
* resolve the path and exit the loop if found
*/
if (strlen(path) + strlen(file) >= MAXPATHLEN) {
errno = ENAMETOOLONG;
if (strlen(path) + strlen(file) + 1 >= MAXPATHLEN) {
(void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], file);
exit(1);
}