mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
[qwaq] Be paranoid about memcpy and null pointers
Although I suspect memcpy does the right thing when the byte count is 0, the man page wasn't explicit and this is more portable.
This commit is contained in:
parent
349f8067c3
commit
1d86a18eb1
1 changed files with 6 additions and 2 deletions
|
@ -650,8 +650,12 @@ bi_get_device_info (progs_t *pr)
|
|||
in_axisinfo_t *axes = PR_Zone_Malloc (pr, axis_buffer->size);
|
||||
in_buttoninfo_t *buttons = PR_Zone_Malloc (pr, button_buffer->size);
|
||||
|
||||
memcpy (axes, axis_buffer->str, axis_buffer->size);
|
||||
memcpy (buttons, button_buffer->str, button_buffer->size);
|
||||
if (axes) {
|
||||
memcpy (axes, axis_buffer->str, axis_buffer->size);
|
||||
}
|
||||
if (buttons) {
|
||||
memcpy (buttons, button_buffer->str, button_buffer->size);
|
||||
}
|
||||
|
||||
devinfo->name = PR_SetDynamicString (pr, name_string->str);
|
||||
devinfo->id = PR_SetDynamicString (pr, id_string->str);
|
||||
|
|
Loading…
Reference in a new issue