Skip to content

Commit

Permalink
Merge pull request #21 from jnpkrn/fix-memmove-segfault
Browse files Browse the repository at this point in the history
Fix segfault when memmoving with negative/enormous n
  • Loading branch information
brarcher committed Mar 5, 2016
2 parents 766ab2c + 25a8706 commit 71034f6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/check_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ RcvMsg *punpack(FILE * fdes)
/* Parse one message */
n = get_result(buf, rmsg);
nparse -= n;
if (nparse < 0)
eprintf("Error in call to get_result", __FILE__, __LINE__ - 3);
/* Move remaining data in buffer to the beginning */
memmove(buf, buf + n, nparse);
/* If EOF has not been seen */
Expand Down

0 comments on commit 71034f6

Please sign in to comment.