diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-04-30 16:38:27 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-04-30 23:38:56 +0000 |
commit | deb687b3763530faea3c34b244c58f1cd1660ec2 (patch) | |
tree | 05112ab1b16bae573235742fb0f1a98189e7cf55 /wiretap/pppdump.c | |
parent | b39f0f32f9868b86f4c790d69f3267061b314fa8 (diff) |
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 <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/pppdump.c')
-rw-r--r-- | wiretap/pppdump.c | 11 |
1 files changed, 9 insertions, 2 deletions
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) <daniel.thompson@st.com> /* 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; |