From deb687b3763530faea3c34b244c58f1cd1660ec2 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 30 Apr 2016 16:38:27 -0700 Subject: Return the same error for too-large packets as we do for other files. And note that our limit (which is what we use as the fixed buffer size) is less than WTAP_MAX_PACKET_SIZE, so we don't have to check against WTAP_MAX_PACKET_SIZE. Change-Id: I28cd95c40fd2fba9994a5d64ef323f1d8c1c4478 Reviewed-on: https://code.wireshark.org/review/15204 Reviewed-by: Guy Harris --- wiretap/pppdump.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'wiretap/pppdump.c') diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index 0d8b6e2b18..da14798414 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -84,6 +84,9 @@ Daniel Thompson (STMicroelectronics) /* this buffer must be at least (2*PPPD_MTU) + sizeof(ppp_header) + * sizeof(lcp_header) + sizeof(ipcp_header). PPPD_MTU is *very* rarely * larger than 1500 so this value is fine. + * + * It's less than WTAP_MAX_PACKET_SIZE, so we don't have to worry about + * too-large packets. */ #define PPPD_BUF_SIZE 8192 @@ -429,7 +432,9 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, } if (num_written > PPPD_BUF_SIZE) { - *err = WTAP_ERR_UNC_OVERFLOW; + *err = WTAP_ERR_BAD_FILE; + *err_info = g_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", + num_written, PPPD_BUF_SIZE); return -1; } @@ -521,7 +526,9 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, } if (pkt->cnt >= PPPD_BUF_SIZE) { - *err = WTAP_ERR_UNC_OVERFLOW; + *err = WTAP_ERR_BAD_FILE; + *err_info = g_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", + pkt->cnt - 1, PPPD_BUF_SIZE); return -1; } pkt->buf[pkt->cnt++] = c; -- cgit v1.2.1