]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/general-scheme.cc
Issue 4890: Fix ly:format for the string that contain zero
[lilypond.git] / lily / general-scheme.cc
index d5fe89024cd2fa7c0cce49968a74f665d8465795..02cf2fa76bf3c660a473b70da7ae543b574297af 100644 (file)
@@ -595,7 +595,9 @@ LY_DEFINE (ly_format, "ly:format",
   char *ptr = result;
   for (vsize i = 0; i < results.size (); i++)
     {
-      strncpy (ptr, results[i].c_str (), results[i].size ());
+      // strcpy and strncpy cannot be used here
+      // because std::string may contain '\0' in its contents.
+      results[i].copy (ptr, results[i].size ());
       ptr += results[i].size ();
     }
   *ptr = '\0';