]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/props.cxx
Patch from Melchior Franz:
[simgear.git] / simgear / misc / props.cxx
index fc0e549affe34c7d5a89d8fc821c245619b2f956..9aeb2385450b8c1e0678dc824dacc35cfa6dec13 100644 (file)
@@ -221,9 +221,8 @@ copy_string (const char * s)
                                // FIXME: potential buffer overflow.
                                // For some reason, strnlen and
                                // strncpy cause all kinds of crashes.
-  string str = s;
-  char * copy = new char[str.size() + 1];
-  strcpy(copy, str.c_str());
+  char * copy = new char[strlen(s) + 1];
+  strcpy(copy, s);
   return copy;
 }