chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
08b0b97
)
process-util: fix two bugs in get_process_cmdline() (#3555)
author
Lennart Poettering
<lennart@poettering.net>
Thu, 16 Jun 2016 20:46:44 +0000
(22:46 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:13:01 +0000
(10:13 +0200)
See:
https://github.com/elogind/elogind/pull/3529#issuecomment-
226421007
src/basic/process-util.c
patch
|
blob
|
history
diff --git
a/src/basic/process-util.c
b/src/basic/process-util.c
index dd77df2ab10c196327819d5a02efe9c7986c8351..5bf0a180bea7f1b2fedf6dbd73d52f23e9541ddc 100644
(file)
--- a/
src/basic/process-util.c
+++ b/
src/basic/process-util.c
@@
-160,6
+160,8
@@
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
if (len > 0)
r[len] = 0;
if (len > 0)
r[len] = 0;
+ else
+ r = mfree(r);
} else {
bool dotdotdot = false;
} else {
bool dotdotdot = false;
@@
-213,7
+215,7
@@
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
}
strncpy(k, "...", left-1);
}
strncpy(k, "...", left-1);
- k[left] = 0;
+ k[left
-1
] = 0;
} else
*k = 0;
}
} else
*k = 0;
}