Skip to content

Commit

Permalink
dump: fix Out-of-bounds write
Browse files Browse the repository at this point in the history
CID 73355 (#1 of 1): Out-of-bounds write (OVERRUN)
6. overrun-local: Overrunning array loc_buf of 4096 bytes at byte offset 4096 using index ret (which evaluates to 4096).
  • Loading branch information
avagin committed Oct 31, 2014
1 parent 5cf6e9b commit 32c2c0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cr-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ static int get_task_personality(pid_t pid, u32 *personality)
if (fd < 0)
goto err;

ret = read(fd, loc_buf, sizeof(loc_buf));
ret = read(fd, loc_buf, sizeof(loc_buf) - 1);
close(fd);

if (ret >= 0) {
Expand Down Expand Up @@ -756,7 +756,7 @@ static int parse_children(pid_t pid, pid_t **_c, int *_n)
if (fd < 0)
goto err;

len = read(fd, loc_buf, sizeof(loc_buf));
len = read(fd, loc_buf, sizeof(loc_buf) - 1);
close(fd);
if (len < 0)
goto err;
Expand Down

0 comments on commit 32c2c0e

Please sign in to comment.