Browse Source

Fix string.format() for non-finite numbers.

Mike Pall 15 years ago
parent
commit
06ae534328
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/lib_string.c

+ 1 - 0
src/lib_string.c

@@ -746,6 +746,7 @@ LJLIB_CF(string_format)
 	    nbuf[len-2] = nbuf[len-2] - 0x20;
 	    nbuf[len-1] = nbuf[len-1] - 0x20;
 	  }
+	  nbuf[len] = '\0';
 	  for (p = form; *p < 'e' && *p != '.'; p++) ;
 	  *p++ = 's'; *p = '\0';
 	  sprintf(buff, form, nbuf);