Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't memset to zero
authorChristophe Thiéry <christopho128@gmail.com>
Fri, 28 Oct 2011 10:11:00 +0000 (12:11 +0200)
committerChristophe Thiéry <christopho128@gmail.com>
Fri, 28 Oct 2011 10:11:00 +0000 (12:11 +0200)
src/bindings/lua/lua_utils.c

index 84b8ca2..3f1f523 100644 (file)
@@ -103,7 +103,9 @@ const char* sglua_get_spaces(int length) {
   static char spaces[128];
 
   xbt_assert(length < 128);
   static char spaces[128];
 
   xbt_assert(length < 128);
-  memset(spaces, ' ', length);
+  if (length != 0) {
+    memset(spaces, ' ', length);
+  }
   spaces[length] = '\0';
   return spaces;
 }
   spaces[length] = '\0';
   return spaces;
 }