mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-03 11:28:58 +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);
|
||||
return FALSE;
|
||||
}
|
||||
if (n + src_offset > src_sz) {
|
||||
if (src_offset > src_sz || n + src_offset > src_sz) {
|
||||
g_set_error(error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_READ,
|
||||
@ -361,7 +361,7 @@ fu_memcpy_safe(guint8 *dst,
|
||||
(guint)dst_sz);
|
||||
return FALSE;
|
||||
}
|
||||
if (n + dst_offset > dst_sz) {
|
||||
if (dst_offset > dst_sz || n + dst_offset > dst_sz) {
|
||||
g_set_error(error,
|
||||
FWUPD_ERROR,
|
||||
FWUPD_ERROR_WRITE,
|
||||
|
Loading…
Reference in New Issue
Block a user