diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-08-09 03:04:19 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-08-09 10:04:56 +0000 |
commit | f543d4a2fdbdacfdd2308c27b904f3cbecba6e67 (patch) | |
tree | a62822e93e89e88f057843321498c33d78de237b | |
parent | 1ac6908cea447387a9da1901ad9335c0111cce24 (diff) |
"It's not a valid text line" means "it's not an RFC 7468 file", not "it's bad".
Don't return an error unless we get a read error. If the line could be
read, but isn't a valid text line, that just means it's not an RFC 7468
text file.
Change-Id: I04f48294cac213cf61b8dcb851b99dc6dd776df8
Reviewed-on: https://code.wireshark.org/review/29039
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | wiretap/rfc7468.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/wiretap/rfc7468.c b/wiretap/rfc7468.c index 08b5a35e33..3d7cb56b82 100644 --- a/wiretap/rfc7468.c +++ b/wiretap/rfc7468.c @@ -67,14 +67,12 @@ static char *read_complete_text_line(char line[MAX_LINE_LENGTH], FILE_T fh, int } if (strlen(line) != (size_t)(line_end - line)) { - *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup("unexpected NUL inside a line"); + *err = 0; return NULL; } if (line_end[-1] != '\n' && !file_eof(fh)) { - *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup("overlong line"); + *err = 0; return NULL; } @@ -132,7 +130,7 @@ wtap_open_return_val rfc7468_open(wtap *wth, int *err, gchar **err_info) found_preeb = FALSE; for (unsigned int i = 0; i < MAX_EXPLANATORY_TEXT_LINES; i++) { if (!read_complete_text_line(line, wth->fh, err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) + if (*err == 0 || *err == WTAP_ERR_SHORT_READ) return WTAP_OPEN_NOT_MINE; return WTAP_OPEN_ERROR; } |