[CRIU] [PATCH] kerndat: pass null-terminated string into strstr
Andrey Vagin
avagin at openvz.org
Fri May 1 04:08:16 PDT 2015
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
kerndat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kerndat.c b/kerndat.c
index 583414c..03264c0 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -294,11 +294,12 @@ int kerndat_fdinfo_has_lock()
if (pfd < 0)
goto out;
- len = read(pfd, buf, sizeof(buf));
+ len = read(pfd, buf, sizeof(buf) - 1);
if (len < 0) {
pr_perror("Unable to read");
goto out;
}
+ buf[len] = 0;
kdat.has_fdinfo_lock = (strstr(buf, "lock:") != NULL);
--
2.1.0
More information about the CRIU
mailing list