mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
patch: don't run off the end of path if it ends in '/'.
Found by fuzzing (afl) in OpenBSD. Obtained from: OpenBSD (CVS 1.65)
This commit is contained in:
parent
395b9c9977
commit
9610cbc09e
@ -1618,7 +1618,8 @@ num_components(const char *path)
|
||||
size_t n;
|
||||
const char *cp;
|
||||
|
||||
for (n = 0, cp = path; (cp = strchr(cp, '/')) != NULL; n++, cp++) {
|
||||
for (n = 0, cp = path; (cp = strchr(cp, '/')) != NULL; n++) {
|
||||
cp++;
|
||||
while (*cp == '/')
|
||||
cp++; /* skip consecutive slashes */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user