diff options
author | nijtmans <nijtmans> | 2010-11-24 15:11:36 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-11-24 15:11:36 (GMT) |
commit | e98b7d37a17da32d58fd2bbdc69ee041a6e8be50 (patch) | |
tree | b6cc0de7a53a58703e812ff7bdb1882714fb7716 /win | |
parent | 09724c70459a4e93f73d3986ee424de4838c525e (diff) | |
download | tk-e98b7d37a17da32d58fd2bbdc69ee041a6e8be50.zip tk-e98b7d37a17da32d58fd2bbdc69ee041a6e8be50.tar.gz tk-e98b7d37a17da32d58fd2bbdc69ee041a6e8be50.tar.bz2 |
[Bug #3071836]: Crash/Tcl_Panic on WinXP saving file to C:\
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinDialog.c | 12 |
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; |