fixed unsafe usage of malloc() pointed out by jtsiomb.
This commit is contained in:
parent
c93cdcdbbd
commit
aa5514903d
@ -129,7 +129,7 @@ struct tagSFG_PlatformJoystick
|
|||||||
|
|
||||||
/* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
|
/* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
|
||||||
/* Spaceball device functions, defined in fg_spaceball_mswin.c */
|
/* Spaceball device functions, defined in fg_spaceball_mswin.c */
|
||||||
//Added by Jinrong Xie (stonexjr @ gmail.com) 12/24/2014
|
//Added by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
|
||||||
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||||
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <GL/freeglut.h>
|
#include <GL/freeglut.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "../fg_internal.h"
|
#include "../fg_internal.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -121,7 +122,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||||||
if (res == -1)
|
if (res == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rawInputBuffer = (BYTE*)malloc(size);
|
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
|
||||||
pRawInput = (PRAWINPUT)rawInputBuffer;
|
pRawInput = (PRAWINPUT)rawInputBuffer;
|
||||||
|
|
||||||
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
|
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
|
||||||
|
Reference in New Issue
Block a user