mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 15:50:29 +00:00
ihex: Do not dump binary out to the terminal for corrupt files
This commit is contained in:
parent
6271176c33
commit
f3539621ee
@ -69,11 +69,24 @@ fu_ihex_firmware_record_new (guint ln, const gchar *line,
|
|||||||
|
|
||||||
/* check starting token */
|
/* check starting token */
|
||||||
if (line[0] != ':') {
|
if (line[0] != ':') {
|
||||||
g_set_error (error,
|
g_autoptr(GString) str = g_string_new (NULL);
|
||||||
FWUPD_ERROR,
|
for (gsize i = 0; line[i] != '\0' && i < 5; i++) {
|
||||||
FWUPD_ERROR_INVALID_FILE,
|
if (!g_ascii_isprint (line[i]))
|
||||||
"invalid starting token: %s",
|
break;
|
||||||
line);
|
g_string_append_c (str, line[i]);
|
||||||
|
}
|
||||||
|
if (str->len > 0) {
|
||||||
|
g_set_error (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INVALID_FILE,
|
||||||
|
"invalid starting token: %s",
|
||||||
|
str->str);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
g_set_error_literal (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INVALID_FILE,
|
||||||
|
"invalid starting token");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user