mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 10:22:17 +00:00
trivial: Fix AddressSanitizer heap-buffer-overflow
This commit is contained in:
parent
60a4b56802
commit
a4e0de462c
@ -1896,7 +1896,7 @@ fu_common_strsafe (const gchar *str, gsize maxsz)
|
|||||||
|
|
||||||
/* replace non-printable chars with '.' */
|
/* replace non-printable chars with '.' */
|
||||||
tmp = g_string_sized_new (maxsz);
|
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])) {
|
if (!g_ascii_isprint (str[i])) {
|
||||||
g_string_append_c (tmp, '.');
|
g_string_append_c (tmp, '.');
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user