sudo_open_parent_dir: adjust loop terminating condition
Checking for ep < pathend should be a bit clearer than ep != '\0' and has the advantage of working when pathend doesn't point to a NUL byte. No intended change in behavior.
This commit is contained in:
@@ -106,7 +106,7 @@ sudo_open_parent_dir_v1(const char *path, uid_t uid, gid_t gid, mode_t mode,
|
||||
|
||||
/* Iterate over path components, skipping the last one. */
|
||||
pathend = cp + strlen(cp);
|
||||
for (cp = sudo_strsplit(cp, pathend, "/", &ep); cp != NULL && *ep != '\0';
|
||||
for (cp = sudo_strsplit(cp, pathend, "/", &ep); cp != NULL && ep < pathend;
|
||||
cp = sudo_strsplit(NULL, pathend, "/", &ep)) {
|
||||
size_t len = (size_t)(ep - cp);
|
||||
int dfd;
|
||||
|
Reference in New Issue
Block a user