summaryrefslogtreecommitdiffstats
path: root/win/tkWinDialog.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-11-24 15:11:36 (GMT)
committernijtmans <nijtmans>2010-11-24 15:11:36 (GMT)
commit469136a58ad9c2323851bd9393c30914511395aa (patch)
treeb6cc0de7a53a58703e812ff7bdb1882714fb7716 /win/tkWinDialog.c
parent86dd30ea9a9b228f8e18b0d2a633cc44a79c9d38 (diff)
downloadtk-469136a58ad9c2323851bd9393c30914511395aa.zip
tk-469136a58ad9c2323851bd9393c30914511395aa.tar.gz
tk-469136a58ad9c2323851bd9393c30914511395aa.tar.bz2
[Bug #3071836]: Crash/Tcl_Panic on WinXP saving file to C:\
Diffstat (limited to 'win/tkWinDialog.c')
-rw-r--r--win/tkWinDialog.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 6783585..b4853bb 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDialog.c,v 1.50.2.9 2010/05/19 11:22:59 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinDialog.c,v 1.50.2.10 2010/11/24 15:11:36 nijtmans Exp $
*
*/
@@ -1026,7 +1026,10 @@ OFNHookProcW(
dirsize = SendMessageW(hdlg, CDM_GETFOLDERPATH, 0, 0);
buffersize = (selsize + dirsize + 1) * 2;
- if (selsize > 1) {
+ /*
+ * Just empty the buffer if dirsize indicates an error [Bug 3071836]
+ */
+ if ((selsize > 1) && (dirsize > 0)) {
if (ofnData->dynFileBufferSize < buffersize) {
buffer = (WCHAR *) ckrealloc((char *) buffer, buffersize);
ofnData->dynFileBufferSize = buffersize;
@@ -1572,7 +1575,10 @@ OFNHookProcA(
dirsize = SendMessage(hdlg, CDM_GETFOLDERPATH, 0, 0);
buffersize = selsize + dirsize + 1;
- if (selsize > 1) {
+ /*
+ * Just empty the buffer if dirsize indicates an error [Bug 3071836]
+ */
+ if ((selsize > 1) && (dirsize > 0)) {
if (ofnData->dynFileBufferSize < buffersize) {
buffer = ckrealloc(buffer, buffersize);
ofnData->dynFileBufferSize = buffersize;