trivial: Fix AddressSanitizer heap-buffer-overflow

This commit is contained in:
Richard Hughes 2021-02-14 20:33:47 +00:00
parent 60a4b56802
commit a4e0de462c

View File

@ -1896,7 +1896,7 @@ fu_common_strsafe (const gchar *str, gsize maxsz)
/* replace non-printable chars with '.' */
tmp = g_string_sized_new (maxsz);
for (gsize i = 0; str[i] != '\0' && i < maxsz; i++) {
for (gsize i = 0; i < maxsz && str[i] != '\0'; i++) {
if (!g_ascii_isprint (str[i])) {
g_string_append_c (tmp, '.');
continue;