shithub: libmujs

Download patch

ref: 9d72b07e0b98edfbf14ab633f38e74c0c549f60f
parent: d04cbf3cc7ece02439e24f671af19c07e7745ae2
author: Tor Andersson <tor.andersson@artifex.com>
date: Tue Apr 24 11:46:03 EDT 2018

Don't forget to zero-terminate string buffer in Fp_toString.

--- a/jsfunction.c
+++ b/jsfunction.c
@@ -26,6 +26,7 @@
 			js_puts(J, &sb, js_tostring(J, i));
 		}
 		js_putc(J, &sb, ')');
+		js_putc(J, &sb, 0);
 	}
 
 	/* body */
@@ -71,6 +72,7 @@
 			js_puts(J, &sb, F->vartab[i]);
 		}
 		js_puts(J, &sb, ") { ... }");
+		js_putc(J, &sb, 0);
 
 		js_pushstring(J, sb->s);
 		js_endtry(J);
@@ -84,6 +86,7 @@
 		js_puts(J, &sb, "function ");
 		js_puts(J, &sb, self->u.c.name);
 		js_puts(J, &sb, "() { ... }");
+		js_putc(J, &sb, 0);
 
 		js_pushstring(J, sb->s);
 		js_endtry(J);