mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Two fixes for copy_load_info.c
* Additional check before copying data in clone_retro_game_info * Sizes the dest string list in string_list_clone to capacity rather than size
This commit is contained in:
parent
16df2ceb4e
commit
dd6eb92352
@ -37,12 +37,15 @@ static struct retro_game_info* clone_retro_game_info(const
|
|||||||
dest->data = NULL;
|
dest->data = NULL;
|
||||||
dest->path = strcpy_alloc(src->path);
|
dest->path = strcpy_alloc(src->path);
|
||||||
|
|
||||||
data = malloc(src->size);
|
if (src->size && src->data)
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
{
|
||||||
memcpy(data, src->data, src->size);
|
data = malloc(src->size);
|
||||||
dest->data = data;
|
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
memcpy(data, src->data, src->size);
|
||||||
|
dest->data = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->size = src->size;
|
dest->size = src->size;
|
||||||
@ -77,9 +80,13 @@ static struct string_list *string_list_clone(
|
|||||||
|
|
||||||
dest->size = src->size;
|
dest->size = src->size;
|
||||||
dest->cap = src->cap;
|
dest->cap = src->cap;
|
||||||
|
if (dest->cap < dest->size)
|
||||||
|
{
|
||||||
|
dest->cap = dest->size;
|
||||||
|
}
|
||||||
|
|
||||||
elems = (struct string_list_elem*)
|
elems = (struct string_list_elem*)
|
||||||
calloc(dest->size, sizeof(struct string_list_elem));
|
calloc(dest->cap, sizeof(struct string_list_elem));
|
||||||
|
|
||||||
if (!elems)
|
if (!elems)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user