summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2021-04-13 20:23:15 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2021-05-20 18:48:20 +0900
commit121ab7ff8fd1fb66e74431b71b5e0703e9912de1 (patch)
tree754cfbd9ec5d62f5c6291570ac5a2123210e8bfa
parent6192674bed14c2f3aa307b8761377f322dc76c29 (diff)
downloadkmod-121ab7ff8fd1fb66e74431b71b5e0703e9912de1.tar.gz
kmod-121ab7ff8fd1fb66e74431b71b5e0703e9912de1.tar.bz2
kmod-121ab7ff8fd1fb66e74431b71b5e0703e9912de1.zip
libkmod: fix possible double free with wrong modules.builtin.modinfo
Fix double free for *modinfo with non '\0' terminated wrong modules.builtin.modinfo, which is because EOF is minus value. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> [sw0312.kim: cherry-pick mainline commit 675410c3b3b1] Change-Id: I9899505ff12d1444013b92007bb0474115047104
-rw-r--r--libkmod/libkmod-builtin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkmod/libkmod-builtin.c b/libkmod/libkmod-builtin.c
index a75a542..a002cb5 100644
--- a/libkmod/libkmod-builtin.c
+++ b/libkmod/libkmod-builtin.c
@@ -313,7 +313,7 @@ ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname,
while (offset < iter->next) {
offset = get_string(iter, pos, &line, &linesz);
if (offset <= 0) {
- count = (offset) ? -errno : -EOF;
+ count = (offset) ? -errno : -EINVAL;
free(*modinfo);
goto fail;
}