]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tools: bpftool: fix potential format truncation
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 16 Mar 2018 06:26:15 +0000 (23:26 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 16 Mar 2018 08:23:15 +0000 (09:23 +0100)
GCC 7 complains:

xlated_dumper.c: In function â€˜print_call’:
xlated_dumper.c:179:10: warning: â€˜%s’ directive output may be truncated writing up to 255 bytes into a region of size between 249 and 253 [-Wformat-truncation=]
     "%+d#%s", insn->off, sym->name);

Add a bit more space to the buffer so it can handle the entire
string and integer without truncation.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/xlated_dumper.h

index 51c935d38ae2bdfa1bb0bd325e38bfba8ffe1d70..b34affa7ef2de40efa5e00388b0e806ff66c47b6 100644 (file)
@@ -49,7 +49,7 @@ struct dump_data {
        unsigned long address_call_base;
        struct kernel_sym *sym_mapping;
        __u32 sym_count;
-       char scratch_buff[SYM_MAX_NAME];
+       char scratch_buff[SYM_MAX_NAME + 8];
 };
 
 void kernel_syms_load(struct dump_data *dd);