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>
}
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;
}
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;
}