summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--tests/winDde.test6
-rw-r--r--win/tclWinDde.c12
3 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b623ec..e705980 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-01-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/winDde.test:
+ * win/tclWinDde.c (Tcl_DdeObjCmd): Prevent crash when empty
+ service name is passed to 'dde eval' and goto errorNoResult in
+ request and poke error cases to free up any allocated data.
+
2003-01-16 Mo DeJong <mdejong@users.sourceforge.net>
* win/tclWin32Dll.c (squelch_warnings): Squelch
diff --git a/tests/winDde.test b/tests/winDde.test
index 37d91ee..c573d58 100644
--- a/tests/winDde.test
+++ b/tests/winDde.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: winDde.test,v 1.12 2002/07/10 11:56:45 dgp Exp $
+# RCS: @(#) $Id: winDde.test,v 1.13 2003/01/16 20:51:57 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -164,6 +164,10 @@ test winDde-5.3 {check for bad arguments} {pcOnly} {
set result
} {wrong # args: should be "dde execute ?-async? serviceName topicName value"}
+test winDde-5.4 {DDE eval bad arguments} {pcOnly} {
+ list [catch {dde eval "" "foo"} msg] $msg
+} {1 {invalid service name ""}}
+
#cleanup
file delete -force $::scriptName
::tcltest::cleanupTests
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index 22d17f2..8ee3399 100644
--- a/win/tclWinDde.c
+++ b/win/tclWinDde.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinDde.c,v 1.9 2003/01/16 19:01:59 mdejong Exp $
+ * RCS: @(#) $Id: tclWinDde.c,v 1.10 2003/01/16 20:51:57 hobbs Exp $
*/
#include "tclPort.h"
@@ -1061,7 +1061,7 @@ Tcl_DdeObjCmd(
if (length == 0) {
Tcl_SetStringObj(Tcl_GetObjResult(interp),
"cannot request value of null data", -1);
- return TCL_ERROR;
+ goto errorNoResult;
}
hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL);
DdeFreeStringHandle(ddeInstance, ddeService);
@@ -1107,7 +1107,7 @@ Tcl_DdeObjCmd(
if (length == 0) {
Tcl_SetStringObj(Tcl_GetObjResult(interp),
"cannot have a null item", -1);
- return TCL_ERROR;
+ goto errorNoResult;
}
dataString = Tcl_GetStringFromObj(objv[firstArg + 3], &length);
@@ -1180,6 +1180,12 @@ Tcl_DdeObjCmd(
break;
}
case DDE_EVAL: {
+ if (serviceName == NULL) {
+ Tcl_SetStringObj(Tcl_GetObjResult(interp),
+ "invalid service name \"\"", -1);
+ goto errorNoResult;
+ }
+
objc -= (async + 3);
((Tcl_Obj **) objv) += (async + 3);