summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclIO.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 1a40828..db6382b 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.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: tclIO.c,v 1.74 2004/05/19 19:41:09 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.75 2004/06/01 10:00:21 davygrvy Exp $
*/
#include "tclInt.h"
@@ -6447,8 +6447,19 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue)
return TCL_OK;
} else if ((len > 7) && (optionName[1] == 'b') &&
(strncmp(optionName, "-buffersize", len) == 0)) {
- Tcl_SetChannelBufferSize(chan,
- atoi(newValue)); /* INTL: "C", UTF safe. */
+ int newBufferSize;
+ if (Tcl_GetInt(interp, newValue, &newBufferSize) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (newBufferSize < 10 || newBufferSize > (1024 * 1024)) {
+ if (interp) {
+ Tcl_AppendResult(interp, "bad value for -buffersize: ",
+ "must not be less than 10 or greater than 1Mbyte.",
+ NULL);
+ }
+ return TCL_ERROR;
+ }
+ Tcl_SetChannelBufferSize(chan, newBufferSize);
} else if ((len > 2) && (optionName[1] == 'e') &&
(strncmp(optionName, "-encoding", len) == 0)) {
Tcl_Encoding encoding;