diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-10-02 04:03:28 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-10-02 11:06:23 +0000 |
commit | 5df87a5ad7b9f90519633c2ba793e57dce6ad212 (patch) | |
tree | 2fec6da076a14fb06da57b3839e8afe25afb01c0 /wiretap/ascendtext.c | |
parent | 2263ce4f63f91f58d840c628dccaec6a72a0d6fc (diff) |
Don't return TRUE with *err or *err_info set.
Read and seek-read routines shouldn't do that; it causes TShark to
report an error when there was no error.
Change-Id: If564348fa01dce83c6a2317ac56ac8716d514bf7
Reviewed-on: https://code.wireshark.org/review/29972
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/ascendtext.c')
-rw-r--r-- | wiretap/ascendtext.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c index 30e87f0f27..0b9aeaac84 100644 --- a/wiretap/ascendtext.c +++ b/wiretap/ascendtext.c @@ -412,6 +412,15 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, wth->snapshot_length, err, err_info)) return FALSE; + /* Flex might have gotten an EOF and caused *err to be set to + WTAP_ERR_SHORT_READ. If so, that's not an error, as the parser + didn't return an error; set *err to 0, and get rid of any error + string. */ + *err = 0; + if (*err_info != NULL) { + g_free(*err_info); + *err_info = NULL; + } *data_offset = offset; return TRUE; } @@ -428,6 +437,15 @@ static gboolean ascend_seek_read(wtap *wth, gint64 seek_off, wth->snapshot_length, err, err_info)) return FALSE; + /* Flex might have gotten an EOF and caused *err to be set to + WTAP_ERR_SHORT_READ. If so, that's not an error, as the parser + didn't return an error; set *err to 0, and get rid of any error + string. */ + *err = 0; + if (*err_info != NULL) { + g_free(*err_info); + *err_info = NULL; + } return TRUE; } |