diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-12-13 09:53:50 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-12-13 09:53:50 +0000 |
commit | d94bd07f99438278cb11f24b00571ab2907b6bdb (patch) | |
tree | 5f96d0a35c97af466bcb2d5b8a9371327bb0190f /wiretap/daintree-sna.c | |
parent | 1df4ee91090e35c25835204d7175b9395be32606 (diff) |
Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
form of corruption/bogosity in a file, including in a file header as
well as in records in the file. Change the error message
wtap_strerror() returns for it to reflect that.
Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.
svn path=/trunk/; revision=40175
Diffstat (limited to 'wiretap/daintree-sna.c')
-rw-r--r-- | wiretap/daintree-sna.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c index 113ed4a78f..d9094c4452 100644 --- a/wiretap/daintree-sna.c +++ b/wiretap/daintree-sna.c @@ -155,14 +155,14 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) /* parse one line of capture data */ if (sscanf(readLine, "%*s %18" G_GINT64_MODIFIER "u.%9d %9u %" READDATA_MAX_FIELD_SIZE "s", &seconds, &wth->phdr.ts.nsecs, &wth->phdr.len, readData) != 4) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup("daintree_sna: invalid read record"); return FALSE; } /* Daintree doesn't store the FCS, but pads end of packet with 0xffff, which we toss */ if (wth->phdr.len <= FCS_LENGTH) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("daintree_sna: packet length <= %u bytes, no frame data present", FCS_LENGTH); return FALSE; @@ -181,13 +181,13 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) buffer_assure_space(wth->frame_buffer, wth->phdr.caplen); memcpy(buffer_start_ptr(wth->frame_buffer), readData, wth->phdr.caplen); } else { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("daintree_sna: capture length (%u) > packet length (%u)", wth->phdr.caplen, wth->phdr.len); return FALSE; } } else { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup("daintree_sna: invalid packet data"); return FALSE; } @@ -218,14 +218,14 @@ daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header /* ignore all but packet data, since the sequential read pass stored everything else */ if (sscanf(seekLine, "%*s %*u.%*u %*u %" SEEKDATA_MAX_FIELD_SIZE "s", seekData) != 1) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup("daintree_sna: corrupted seek record"); return FALSE; } /* convert packet data from ASCII hex string to guchar */ if ((pkt_len = daintree_sna_hex_char(seekData, err)) <= FCS_LENGTH) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup("daintree_sna: corrupted packet data"); return FALSE; } @@ -236,7 +236,7 @@ daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header /* move to frame buffer for dissection */ memcpy(pd, seekData, pkt_len); } else { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup("daintree-sna: corrupted frame"); return FALSE; } |