]> Devoid-pointer.net GitWeb - FFBChecker.git/commitdiff
Zeroize the SDL_HapticEffect structure before use
authorMichal Malý <madcatxster@devoid-pointer.net>
Fri, 31 Jul 2015 14:12:01 +0000 (16:12 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Fri, 31 Jul 2015 14:12:01 +0000 (16:12 +0200)
sdl2ffbeffect.cpp

index 9133d3d574c5ee0f40e50191f4001d5b15aec889..cc407a98b9402a9de770e085ae77b103a0956e0b 100644 (file)
@@ -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)