mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 07:05:40 +00:00
dep/rcheevos: Don't silently truncate buffers in rc_api_init_fetch_image_request()
This commit is contained in:
parent
fa5c62ef5d
commit
de20c388dd
|
@ -578,7 +578,13 @@ static int rc_client_get_image_url(char buffer[], size_t buffer_size, int image_
|
|||
image_request.image_name = image_name;
|
||||
result = rc_api_init_fetch_image_request(&request, &image_request);
|
||||
if (result == RC_OK)
|
||||
snprintf(buffer, buffer_size, "%s", request.url);
|
||||
{
|
||||
const size_t url_length = strlen(request.url);
|
||||
if (url_length >= buffer_size)
|
||||
result = RC_INSUFFICIENT_BUFFER;
|
||||
else
|
||||
memcpy(buffer, request.url, url_length + 1);
|
||||
}
|
||||
|
||||
rc_api_destroy_request(&request);
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue