diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-06-09 02:32:30 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-06-09 02:32:30 +0000 |
commit | 9f1f58745c38a306490b7534f7ad49d8571fc83a (patch) | |
tree | 1e7be59635d65bab9b1dd8ce32ec55b61849561e /wiretap/pcapng.c | |
parent | 0b8d569887470f0e7d97c8ba90414045a6be7c8f (diff) | |
download | wireshark-9f1f58745c38a306490b7534f7ad49d8571fc83a.tar.gz wireshark-9f1f58745c38a306490b7534f7ad49d8571fc83a.tar.bz2 wireshark-9f1f58745c38a306490b7534f7ad49d8571fc83a.zip |
Don't treat zero-length names in the NRB as errors, just silently ignore
them.
Works around the problem reported in bug 8763.
svn path=/trunk/; revision=49851
Diffstat (limited to 'wiretap/pcapng.c')
-rw-r--r-- | wiretap/pcapng.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index e365da4158..263c17e901 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -1466,8 +1466,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t * * * Return the length of the name, including the terminating NUL. * - * If we don't find the terminating NUL, or if the name is zero-length - * (not counting the terminating NUL), return -1 and set *err and + * If we don't find a terminating NUL, return -1 and set *err and * *err_info appropriately. */ static int @@ -1493,12 +1492,6 @@ name_resolution_block_find_name_end(guint8 *p, guint record_len, int *err, record_len--; namelen++; /* count this byte */ } - if (namelen == 0) { - /* The name is empty. */ - *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup("pcapng_read_name_resolution_block: NRB record has empty host name"); - return -1; - } /* Include the NUL in the name length. */ return namelen + 1; @@ -1650,7 +1643,13 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t buffer_free(&nrb_rec); return -1; /* fail */ } - pn->add_new_ipv4(v4_addr, namep); + + /* + * Silently ignore zero-length + * names. + */ + if (namelen != 1) + pn->add_new_ipv4(v4_addr, namep); } } @@ -1714,8 +1713,15 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t buffer_free(&nrb_rec); return -1; /* fail */ } - pn->add_new_ipv6(buffer_start_ptr(&nrb_rec), - namep); + + /* + * Silently ignore zero-length + * names. + */ + if (namelen != 1) { + pn->add_new_ipv6(buffer_start_ptr(&nrb_rec), + namep); + } } } |