From 0b7e473e092cfbc5077faf2bf6245a37d148aec4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Fri, 31 Jul 2015 16:12:01 +0200 Subject: [PATCH] Zeroize the SDL_HapticEffect structure before use --- sdl2ffbeffect.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdl2ffbeffect.cpp b/sdl2ffbeffect.cpp index 9133d3d..cc407a9 100644 --- a/sdl2ffbeffect.cpp +++ b/sdl2ffbeffect.cpp @@ -23,7 +23,13 @@ const QString SDL2FFBEffect::CAPTION("Invalid FFB parameter"); SDL_HapticEffect* SDL2FFBEffect::createFFstruct() { - return new SDL_HapticEffect; + SDL_HapticEffect* effect = new SDL_HapticEffect; + if (effect == nullptr) + return nullptr; + + memset(effect, 0, sizeof(SDL_HapticEffect)); + + return effect; } bool SDL2FFBEffect::checkEnvelopeParameters(const int attackLength, const int attackLevel, const int fadeLength, const int fadeLevel) -- 2.43.5