Add an overflow check to process_data().

svn path=/trunk/; revision=2675
This commit is contained in:
Gerald Combs 2000-11-19 20:56:17 +00:00
parent cf109dd91a
commit 6cbf7512cb
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/* pppdump.c
*
* $Id: pppdump.c,v 1.5 2000/11/19 03:47:36 guy Exp $
* $Id: pppdump.c,v 1.6 2000/11/19 20:56:17 gerald Exp $
*
* Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org>
*
@ -334,6 +334,11 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, int *er
return 0;
}
if (num_written > sizeof(pd)) {
*err = WTAP_ERR_UNC_OVERFLOW;
return -1;
}
memcpy(pd, pkt->buf, num_written);
num_bytes--;