shithub: libmujs

Download patch

ref: 2f3d5550a410981059437249b441bf164b0081b0
parent: 919238c356c24142457b236307dbcdb4a1b59ab3
author: Tor Andersson <[email protected]>
date: Tue Sep 26 08:50:18 EDT 2017

Use automatic length in "digits" array in Np_toString.

Hard coding the length to 36 does not match the length of the
initializer, which includes the string zero terminator.

Fixes github issue #48.

--- a/jsnumber.c
+++ b/jsnumber.c
@@ -41,7 +41,7 @@
 
 	/* lame number to string conversion for any radix from 2 to 36 */
 	{
-		static const char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
+		static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
 		char buf[100];
 		double number = self->u.number;
 		int sign = self->u.number < 0;