mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 04:48:16 +00:00
Check for overflow when copying buffers with huge offset values
This commit is contained in:
parent
56e5c1b7a9
commit
1ffc2608b0
@ -342,7 +342,7 @@ fu_memcpy_safe(guint8 *dst,
|
|||||||
(guint)src_sz);
|
(guint)src_sz);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (n + src_offset > src_sz) {
|
if (src_offset > src_sz || n + src_offset > src_sz) {
|
||||||
g_set_error(error,
|
g_set_error(error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
FWUPD_ERROR_READ,
|
FWUPD_ERROR_READ,
|
||||||
@ -361,7 +361,7 @@ fu_memcpy_safe(guint8 *dst,
|
|||||||
(guint)dst_sz);
|
(guint)dst_sz);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (n + dst_offset > dst_sz) {
|
if (dst_offset > dst_sz || n + dst_offset > dst_sz) {
|
||||||
g_set_error(error,
|
g_set_error(error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
FWUPD_ERROR_WRITE,
|
FWUPD_ERROR_WRITE,
|
||||||
|
Loading…
Reference in New Issue
Block a user