dep/rcheevos: Don't silently truncate buffers in rc_api_init_fetch_image_request()

This commit is contained in:
Stenzek 2024-09-01 23:50:06 +10:00
parent fa5c62ef5d
commit de20c388dd
No known key found for this signature in database

View file

@ -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; image_request.image_name = image_name;
result = rc_api_init_fetch_image_request(&request, &image_request); result = rc_api_init_fetch_image_request(&request, &image_request);
if (result == RC_OK) 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); rc_api_destroy_request(&request);
return result; return result;