Skip to content

Commit

Permalink
libkmod: Treat illegal modinfo file as error
Browse files Browse the repository at this point in the history
The file modules.builtin.modinfo is supposed to consist of NUL
terminated strings. If the file contains a string which is not
properly NUL terminated, treat it as error.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
  • Loading branch information
stoeckmann committed Aug 21, 2024
1 parent 9fc3aa1 commit ecd0a05
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libkmod/libkmod-builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ static off_t get_string(struct kmod_builtin_iter *iter, off_t offset,
}

if (linesz) {
if (iter->buf[linesz - 1] != '\0') {
sv_errno = EINVAL;
goto fail;
}
*line = iter->buf;
*size = linesz;
}
Expand Down

0 comments on commit ecd0a05

Please sign in to comment.