mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
storage_file_probe: change maximum len value in vmdk4GetBackingStore
desc length should be always less than VIR_STORAGE_MAX_HEADER. If len = VIR_STORAGE_MAX_HEADER, desc may be out of bounds. Fixes: 296032bfb2 ("util: extract storage file probe code into virtstoragefileprobe.c") Signed-off-by: Anastasia Belova <abelova@astralinux.ru> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
eb677e3a10
commit
2c6b5a8425
@ -586,8 +586,8 @@ vmdk4GetBackingStore(char **res,
|
||||
return BACKING_STORE_INVALID;
|
||||
|
||||
len = buf_size - 0x200;
|
||||
if (len > VIR_STORAGE_MAX_HEADER)
|
||||
len = VIR_STORAGE_MAX_HEADER;
|
||||
if (len >= VIR_STORAGE_MAX_HEADER)
|
||||
len = VIR_STORAGE_MAX_HEADER - 1;
|
||||
memcpy(desc, buf + 0x200, len);
|
||||
desc[len] = '\0';
|
||||
start = strstr(desc, prefix);
|
||||
|
Loading…
x
Reference in New Issue
Block a user