summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-01-16 20:51:57 (GMT)
committerhobbs <hobbs>2003-01-16 20:51:57 (GMT)
commit545d7776f7c48ef8faf032296dd9b2b5bda76247 (patch)
tree3686cbe5c214f25e19c8bd56f0ea6f197e9f3a9b /win
parent87b28d9c78944ebbc26e0dfc02d0b4c07bbdba68 (diff)
downloadtcl-545d7776f7c48ef8faf032296dd9b2b5bda76247.zip
tcl-545d7776f7c48ef8faf032296dd9b2b5bda76247.tar.gz
tcl-545d7776f7c48ef8faf032296dd9b2b5bda76247.tar.bz2
* 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.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinDde.c12
1 files changed, 9 insertions, 3 deletions
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);