extras/DynamicString: Missed proper null character safety in earlier commit
[sdk] / extras / types / DynamicString.ec
index 8ff0ca4..6f14d49 100644 (file)
@@ -44,9 +44,9 @@ class DynamicString : Array<char>
       // TODO: improve this to vsprinf directly in the Array<char> instead of calling concat
       char string[MAX_F_STRING];
       va_list args;
-      string[sizeof(string)-1] = 0;
       va_start(args, format);
       vsnprintf(string, sizeof(string), format, args);
+      string[sizeof(string)-1] = 0;
       va_end(args);
       concat(string);
    }