Remove encoding warnings from format_text()

The use of format_text() to sanitize strings by dissectors is
too widespread to make this check useful. Allow it for now.
This commit is contained in:
João Valverde 2022-10-01 22:32:42 +01:00 committed by A Wireshark GitLab Utility
parent 0bc040b44a
commit 539fbafce4
2 changed files with 2 additions and 13 deletions

View File

@ -639,7 +639,6 @@ format_text_internal(wmem_allocator_t *allocator,
FMTBUF_VARS;
const guchar *stringend = string + len;
guchar c;
bool is_valid_utf8 = true;
while (string < stringend) {
/*
@ -790,11 +789,6 @@ format_text_internal(wmem_allocator_t *allocator,
uc = UNREPL;
}
if (uc == UNREPL) {
/* Flag this UTF-8 string as having been sanitized. */
is_valid_utf8 = false;
}
/*
* OK, is it a printable Unicode character?
*/
@ -933,12 +927,6 @@ format_text_internal(wmem_allocator_t *allocator,
FMTBUF_ENDSTR;
if (!is_valid_utf8) {
/* This function expects valid UTF-8 as input. The extra validation performed is a safeguard.
* In a brighter future it may be removed. Emit a warning and display the sanitized string. */
ws_log_full(LOG_DOMAIN_UTF_8, LOG_LEVEL_DEBUG, __FILE__, -1, __func__,
"String argument contained UTF-8 errors: %s", fmtbuf);
}
return fmtbuf;
}

View File

@ -214,7 +214,8 @@ WS_DLL_PUBLIC
char *ws_strdup_underline(wmem_allocator_t *allocator, long offset, size_t len);
/** Given a wmem scope, a not-necessarily-null-terminated string,
* expected to be in UTF-8 and the length of the string,
* expected to be in UTF-8 but possibly containing invalid sequences
* (as it may have come from packet data), and the length of the string,
* generate a valid UTF-8 string from it, allocated in the specified
* wmem scope, that:
*