Skip to content

Commit cdc89c9

Browse files
pbholedavem330
authored andcommitted
tools: bpf: handle long path in jit disasm
Use PATH_MAX instead of hardcoded array size 256 Signed-off-by: Prashant Bhole <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e20f469 commit cdc89c9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tools/bpf/bpf_jit_disasm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <sys/klog.h>
2828
#include <sys/types.h>
2929
#include <sys/stat.h>
30+
#include <limits.h>
3031

3132
#define CMD_ACTION_SIZE_BUFFER 10
3233
#define CMD_ACTION_READ_ALL 3
@@ -51,7 +52,7 @@ static void get_exec_path(char *tpath, size_t size)
5152
static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
5253
{
5354
int count, i, pc = 0;
54-
char tpath[256];
55+
char tpath[PATH_MAX];
5556
struct disassemble_info info;
5657
disassembler_ftype disassemble;
5758
bfd *bfdf;

tools/bpf/bpftool/jit_disasm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <dis-asm.h>
2222
#include <sys/types.h>
2323
#include <sys/stat.h>
24+
#include <limits.h>
2425

2526
#include "json_writer.h"
2627
#include "main.h"
@@ -80,7 +81,7 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes)
8081
disassembler_ftype disassemble;
8182
struct disassemble_info info;
8283
int count, i, pc = 0;
83-
char tpath[256];
84+
char tpath[PATH_MAX];
8485
bfd *bfdf;
8586

8687
if (!len)

0 commit comments

Comments
 (0)