Mouse calibration data might be returned in a non-aligned structure. Copy safely.

ugfx_release_2.6
inmarket 2013-12-21 17:36:40 +10:00
parent e85780bc3f
commit 20854bd69f
1 changed files with 3 additions and 1 deletions

View File

@ -24,6 +24,8 @@
#error "GINPUT: GFX_USE_GDISP must be defined when mouse or touch calibration is required"
#endif
#include <string.h> // Required for memcpy
#define GINPUT_MOUSE_CALIBRATION_FONT "* Double"
#define GINPUT_MOUSE_CALIBRATION_FONT2 "* Narrow"
#define GINPUT_MOUSE_CALIBRATION_TEXT "Calibration"
@ -352,7 +354,7 @@ GSourceHandle ginputGetMouse(uint16_t instance) {
MouseConfig.fnsavecal = ginput_lld_mouse_calibration_save;
#endif
if (MouseConfig.fnloadcal && (pc = (Calibration *)MouseConfig.fnloadcal(instance))) {
MouseConfig.caldata = pc[0];
memcpy(&MouseConfig.caldata, pc, sizeof(MouseConfig.caldata))
MouseConfig.flags |= (FLG_CAL_OK|FLG_CAL_SAVED);
if ((MouseConfig.flags & FLG_CAL_FREE))
gfxFree((void *)pc);