summaryrefslogtreecommitdiffstats
path: root/win/tclWinDde.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2003-01-16 20:51:57 (GMT)
committerhobbs <hobbs@noemail.net>2003-01-16 20:51:57 (GMT)
commitf7278d4e4f4ac20dabbe05a764a309ce71e3e7b2 (patch)
tree3686cbe5c214f25e19c8bd56f0ea6f197e9f3a9b /win/tclWinDde.c
parent3c27c898a370a972f428790856e6eb1ca661e402 (diff)
downloadtcl-f7278d4e4f4ac20dabbe05a764a309ce71e3e7b2.zip
tcl-f7278d4e4f4ac20dabbe05a764a309ce71e3e7b2.tar.gz
tcl-f7278d4e4f4ac20dabbe05a764a309ce71e3e7b2.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. FossilOrigin-Name: 5cc2be8bc8e356e572f8dacb9a7644b7bf805176
Diffstat (limited to 'win/tclWinDde.c')
-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);