Skip to content

Commit

Permalink
Fix process map parsing when freeing bcc memory (iovisor#2151)
Browse files Browse the repository at this point in the history
This fixes the format string used to parse the major and minor
device fields in /proc/self/maps. These fields have hexadecimal
values and hence cannot be parsed as unsigned integers.

Fixes: 51480d0 ("implement free_bcc_memory() API (iovisor#2097)")
Reported-by: Nageswara R Sastry [email protected]
Signed-off-by: Sandipan Das <[email protected]>
  • Loading branch information
sandip4n authored and yonghong-song committed Jan 17, 2019
1 parent cda5f98 commit dd13242
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cc/bcc_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ int bcc_free_memory() {
int path_start = 0, path_end = 0;
unsigned int devmajor, devminor;
char perms[8];
if (sscanf(line, "%lx-%lx %7s %lx %u:%u %lu %n%*[^\n]%n",
if (sscanf(line, "%lx-%lx %7s %lx %x:%x %lu %n%*[^\n]%n",
&addr_start, &addr_end, perms, &offset,
&devmajor, &devminor, &inode,
&path_start, &path_end) < 7)
Expand Down

0 comments on commit dd13242

Please sign in to comment.