projects
/
platform
/
core
/
system
/
crash-worker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6507ecd
)
Fix: Do not index buffer[] with negative index in case of read failure
28/190528/1
author
Karol Lewandowski
<k.lewandowsk@samsung.com>
Wed, 3 Oct 2018 09:29:30 +0000
(11:29 +0200)
committer
Karol Lewandowski
<k.lewandowsk@samsung.com>
Wed, 3 Oct 2018 09:29:39 +0000
(11:29 +0200)
Issue reported by Coverity.
Change-Id: Ie9cd66d2801770a096bb1849d11c860533508174
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index
8273ca2
..
e6a2cff
100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-742,14
+742,13
@@
char* get_cmd_line(pid_t pid)
char buffer[PATH_MAX];
ssize_t ret = read(fd, buffer, sizeof(buffer) - 1);
- buffer[ret] = '\0';
close(fd);
-
if (ret <= 0) {
_E("Failed to read %s: %m\n", cmdline_path);
return NULL;
}
+ buffer[ret] = '\0';
char *result;
if (asprintf(&result, "%s", buffer) == -1) {