projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2532f84
)
tools resolve_btfids: Add size check to get_id function
author
Jiri Olsa
<jolsa@kernel.org>
Tue, 25 Aug 2020 19:21:11 +0000
(21:21 +0200)
committer
Alexei Starovoitov
<ast@kernel.org>
Tue, 25 Aug 2020 22:37:41 +0000
(15:37 -0700)
To make sure we don't crash on malformed symbols.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link:
https://lore.kernel.org/bpf/20200825192124.710397-2-jolsa@kernel.org
tools/bpf/resolve_btfids/main.c
patch
|
blob
|
history
diff --git
a/tools/bpf/resolve_btfids/main.c
b/tools/bpf/resolve_btfids/main.c
index
4d9ecb9
..
35a172d
100644
(file)
--- a/
tools/bpf/resolve_btfids/main.c
+++ b/
tools/bpf/resolve_btfids/main.c
@@
-199,9
+199,16
@@
static char *get_id(const char *prefix_end)
/*
* __BTF_ID__func__vfs_truncate__0
* prefix_end = ^
+ * pos = ^
*/
- char *p, *id = strdup(prefix_end + sizeof("__") - 1);
+ int len = strlen(prefix_end);
+ int pos = sizeof("__") - 1;
+ char *p, *id;
+ if (pos >= len)
+ return NULL;
+
+ id = strdup(prefix_end + pos);
if (id) {
/*
* __BTF_ID__func__vfs_truncate__0