kerndat: pass null-terminated string into strstr

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2015-05-01 14:08:00 +03:00 committed by Pavel Emelyanov
parent 59bb688033
commit 281a0f9d20

View file

@ -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);