projects
/
platform
/
upstream
/
bcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa4543f
)
bcc_proc.c: fix stack overflow in bcc_procutils_which()
author
Christian Resell
<christian.resell@gmail.com>
Fri, 26 May 2017 14:50:52 +0000
(16:50 +0200)
committer
Brenden Blanco
<bblanco@gmail.com>
Tue, 30 May 2017 15:32:17 +0000
(08:32 -0700)
src/cc/bcc_proc.c
patch
|
blob
|
history
diff --git
a/src/cc/bcc_proc.c
b/src/cc/bcc_proc.c
index
73f62c3
..
5343dbb
100644
(file)
--- a/
src/cc/bcc_proc.c
+++ b/
src/cc/bcc_proc.c
@@
-46,9
+46,8
@@
char *bcc_procutils_which(const char *binpath) {
const size_t path_len = next - PATH;
if (path_len) {
- memcpy(buffer, PATH, path_len);
- buffer[path_len] = '/';
- strcpy(buffer + path_len + 1, binpath);
+ snprintf(buffer, sizeof(buffer), "%.*s/%s",
+ (int)path_len, PATH, binpath);
if (bcc_elf_is_exe(buffer))
return strdup(buffer);