Fix buffer underrun noted and solved by Larry Doolittle.

This commit is contained in:
Matt Kraai 2001-04-19 14:56:23 +00:00
parent 0a3bda2c53
commit 3ce79338e6
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ extern int dirname_main(int argc, char **argv)
argv++; argv++;
s=*argv+strlen(*argv)-1; s=*argv+strlen(*argv)-1;
while (s != *argv && *s == '/') { while (s > *argv && *s == '/') {
*s-- = '\0'; *s-- = '\0';
} }
s = strrchr(*argv, '/'); s = strrchr(*argv, '/');

View File

@ -37,7 +37,7 @@ extern int dirname_main(int argc, char **argv)
argv++; argv++;
s=*argv+strlen(*argv)-1; s=*argv+strlen(*argv)-1;
while (s != *argv && *s == '/') { while (s > *argv && *s == '/') {
*s-- = '\0'; *s-- = '\0';
} }
s = strrchr(*argv, '/'); s = strrchr(*argv, '/');