]> git.mxchange.org Git - simgear.git/commitdiff
hla: Fix buffer overrun in SGMath vector types.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 26 Feb 2012 12:14:39 +0000 (13:14 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Tue, 28 Feb 2012 06:19:21 +0000 (07:19 +0100)
simgear/hla/HLAArrayDataElement.hxx

index de3c1d0aee945e39b5db77d0e4168795ad808818..8f510be59c63a959a406050f34d41e5c859aa87c 100644 (file)
@@ -214,7 +214,7 @@ public:
 
     virtual bool setNumElements(unsigned count)
     {
-        for (unsigned i = 2; i < count; ++i)
+        for (unsigned i = count; i < 2; ++i)
             _value[i] = 0;
         return true;
     }
@@ -306,7 +306,7 @@ public:
 
     virtual bool setNumElements(unsigned count)
     {
-        for (unsigned i = 3; i < count; ++i)
+        for (unsigned i = count; i < 3; ++i)
             _value[i] = 0;
         return true;
     }
@@ -398,7 +398,7 @@ public:
 
     virtual bool setNumElements(unsigned count)
     {
-        for (unsigned i = 4; i < count; ++i)
+        for (unsigned i = count; i < 4; ++i)
             _value[i] = 0;
         return true;
     }
@@ -490,7 +490,7 @@ public:
 
     virtual bool setNumElements(unsigned count)
     {
-        for (unsigned i = 4; i < count; ++i)
+        for (unsigned i = count; i < 4; ++i)
             _value[i] = 0;
         return true;
     }