mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 04:00:41 +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 */
|
||||
if (line[0] != ':') {
|
||||
g_set_error (error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_INVALID_FILE,
|
||||
"invalid starting token: %s",
|
||||
line);
|
||||
g_autoptr(GString) str = g_string_new (NULL);
|
||||
for (gsize i = 0; line[i] != '\0' && i < 5; i++) {
|
||||
if (!g_ascii_isprint (line[i]))
|
||||
break;
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user