Browse Source

Fixed 64bit bufferString bug

Thomas Buck 9 years ago
parent
commit
8f1eb21507
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/utils/strings.cpp

+ 6
- 1
src/utils/strings.cpp View File

@@ -41,6 +41,9 @@ char *bufferString(const char *string, va_list args) {
41 41
 
42 42
     text = new char[sz];
43 43
 
44
+    va_list copy;
45
+    va_copy(copy, args);
46
+
44 47
     n = vsnprintf(text, sz, string, args);
45 48
 
46 49
     if (n < 0) {
@@ -50,9 +53,11 @@ char *bufferString(const char *string, va_list args) {
50 53
         sz = n + 1; // buffer too small
51 54
         delete [] text;
52 55
         text = new char[sz];
53
-        n = vsnprintf(text, sz, string, args);
56
+        n = vsnprintf(text, sz, string, copy);
54 57
     }
55 58
 
59
+    va_end(copy);
60
+
56 61
     return text;
57 62
 }
58 63
 

Loading…
Cancel
Save