mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
[ruamoko] Handle 0-length @va_list for va_copy
Fixes a progs crash when using vsprintf with no format elements + params.
This commit is contained in:
parent
7f96b0fbed
commit
6d4e370a25
1 changed files with 7 additions and 2 deletions
|
@ -56,8 +56,13 @@ bi_va_copy (progs_t *pr)
|
|||
__auto_type src_list = &G_STRUCT (pr, pr_type_t, src_args->list);
|
||||
size_t parm_size = pr->pr_param_size * sizeof(pr_type_t);
|
||||
size_t size = src_args->count * parm_size;
|
||||
string_t dst_list_block = PR_AllocTempBlock (pr, size);
|
||||
__auto_type dst_list = (pr_type_t *) PR_GetString (pr, dst_list_block);
|
||||
string_t dst_list_block = 0;
|
||||
pr_type_t *dst_list = 0;
|
||||
|
||||
if (size) {
|
||||
dst_list_block = PR_AllocTempBlock (pr, size);
|
||||
dst_list = (pr_type_t *) PR_GetString (pr, dst_list_block);
|
||||
}
|
||||
|
||||
memcpy (dst_list, src_list, size);
|
||||
R_PACKED (pr, pr_va_list_t).count = src_args->count;
|
||||
|
|
Loading…
Reference in a new issue