mirror of
https://github.com/systemd/systemd.git
synced 2025-03-25 18:50:18 +03:00
util_create_path(): fix possible out of bounds array access
This commit is contained in:
parent
ebc1ba78ed
commit
4c21b7156d
@ -34,11 +34,12 @@ int util_create_path(struct udev *udev, const char *path)
|
||||
|
||||
util_strscpy(p, sizeof(p), path);
|
||||
pos = strrchr(p, '/');
|
||||
if (pos == p || pos == NULL)
|
||||
if (pos == NULL)
|
||||
return 0;
|
||||
|
||||
while (pos[-1] == '/')
|
||||
while (pos != p && pos[-1] == '/')
|
||||
pos--;
|
||||
if (pos == p)
|
||||
return 0;
|
||||
pos[0] = '\0';
|
||||
|
||||
dbg(udev, "stat '%s'\n", p);
|
||||
|
Loading…
x
Reference in New Issue
Block a user