[mw-devel] MW3 r947 - in trunk: . src

arthur at sucs.org arthur at sucs.org
Thu Apr 19 09:34:20 BST 2007


Author: arthur
Date: 2007-04-19 09:34:18 +0100 (Thu, 19 Apr 2007)
New Revision: 947

Modified:
   trunk/mw.spec
   trunk/src/js.c
Log:
the exec function modifies the string, but js gave us the actual string, so copy it first.  refs #13


Modified: trunk/mw.spec
===================================================================
--- trunk/mw.spec	2007-04-18 18:05:16 UTC (rev 946)
+++ trunk/mw.spec	2007-04-19 08:34:18 UTC (rev 947)
@@ -1,7 +1,7 @@
 Summary: Milliways III talker and BBS
 Name: mw3
 Version: 2.15.0
-Release: 0
+Release: 1
 License: GPL
 Group: Applications/Communications
 Source: %{name}-%{version}.tar.gz

Modified: trunk/src/js.c
===================================================================
--- trunk/src/js.c	2007-04-18 18:05:16 UTC (rev 946)
+++ trunk/src/js.c	2007-04-19 08:34:18 UTC (rev 947)
@@ -162,8 +162,9 @@
 	
 	if (JSVAL_IS_STRING(argv[0])) {
 		jsmsg = JS_ValueToString(cx,argv[0]);
-		msg = JS_GetStringBytes(jsmsg);
+		msg = strdup(JS_GetStringBytes(jsmsg));
 		DoCommand(msg, chattable);
+		free(msg);
 		return JS_TRUE;
 	}
 	return JS_FALSE;
@@ -186,8 +187,9 @@
 	
 	if (JSVAL_IS_STRING(argv[0])) {
 		jsmsg = JS_ValueToString(cx,argv[0]);
-		msg = JS_GetStringBytes(jsmsg);
+		msg = strdup(JS_GetStringBytes(jsmsg));
 		chat_say(msg);
+		free(msg);
 		return JS_TRUE;
 	}
 	return JS_FALSE;





More information about the mw-devel mailing list