Skip to content

Commit b35ae31

Browse files
authored
preload: Fix strncmp off-by-one (#114)
The `"/proc/"` string is of len 6 instead of 5. This was found with a "cstrnfinder" research and I haven't tested this change (more info https://twitter.com/disconnect3d_pl/status/1339757359896408065).
1 parent fabe148 commit b35ae31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libumockdev-preload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ trap_path(const char *path)
154154
if (prefix == NULL)
155155
return path;
156156

157-
if (strncmp(path, "/dev/", 5) == 0 || strcmp(path, "/dev") == 0 || strncmp(path, "/proc/", 5) == 0)
157+
if (strncmp(path, "/dev/", 5) == 0 || strcmp(path, "/dev") == 0 || strncmp(path, "/proc/", 6) == 0)
158158
check_exist = 1;
159159
else if (strncmp(path, "/sys/", 5) != 0 && strcmp(path, "/sys") != 0)
160160
return path;

0 commit comments

Comments
 (0)