Skip to content

Commit 213508a

Browse files
stoeckmannlucasdemarchi
authored andcommitted
libkmod: Prevent ouf of boundary access
Follow up of aad7c69, which fixes the same issue in another function. Signed-off-by: Tobias Stoeckmann <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Link: #248 Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 808eb4b commit 213508a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libkmod/libkmod-module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ KMOD_EXPORT long kmod_module_get_size(const struct kmod_module *mod)
15271527
size = value;
15281528
break;
15291529
eat_line:
1530-
while (line[len - 1] != '\n' && fgets(line, sizeof(line), fp))
1530+
while (len > 0 && line[len - 1] != '\n' && fgets(line, sizeof(line), fp))
15311531
len = strlen(line);
15321532
}
15331533
fclose(fp);

0 commit comments

Comments
 (0)