summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-17 20:57:22 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-17 20:57:22 -0500
commit041b5ae170fe0b0d49611d26ae09e8438099733f (patch)
tree1dabddc46eeefbbf7f76152d1500c7b51b1dfa30
parent347ebd02974ec4d2d7c4a6a388012a223b14583c (diff)
basic/process-util: we need to take the shorter of two strings
==30496== Conditional jump or move depends on uninitialised value(s) ==30496== at 0x489F654: memcmp (vg_replace_strmem.c:1091) ==30496== by 0x49BF203: getenv_for_pid (process-util.c:678) ==30496== by 0x4993ACB: detect_container (virt.c:442) ==30496== by 0x182DFF: test_get_process_comm (test-process-util.c:98) ==30496== by 0x185847: main (test-process-util.c:368) ==30496==
-rw-r--r--src/basic/process-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 48a5c719af..1f4c2e4e43 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -675,7 +675,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value) {
}
line[i] = 0;
- if (memcmp(line, field, l) == 0 && line[l] == '=') {
+ if (strneq(line, field, l) && line[l] == '=') {
value = strdup(line + l + 1);
if (!value)
return -ENOMEM;