diff options
author | dkf <dkf@noemail.net> | 2001-03-06 14:45:02 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2001-03-06 14:45:02 (GMT) |
commit | 3df40c21487ca9e2a0ad7c4fceea4f1b2835fe96 (patch) | |
tree | dedb3eaa49c7bac372525a7a2a096a20372917a8 /generic/tclVar.c | |
parent | b5364b54edbc5a166094f458ecf08cf02d43a18e (diff) | |
download | tcl-3df40c21487ca9e2a0ad7c4fceea4f1b2835fe96.zip tcl-3df40c21487ca9e2a0ad7c4fceea4f1b2835fe96.tar.gz tcl-3df40c21487ca9e2a0ad7c4fceea4f1b2835fe96.tar.bz2 |
Fixed two faults with [unset -nocomplain]; one with a possible overrun
of the argument array, and another with the documentation.
FossilOrigin-Name: 308102bafc14cee55bb361a5dd1f8c84203a7f94
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r-- | generic/tclVar.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c index c160c84..608185e 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.27 2000/11/17 11:06:53 dkf Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.28 2001/03/06 14:45:03 dkf Exp $ */ #include "tclInt.h" @@ -2611,23 +2611,29 @@ Tcl_UnsetObjCmd(dummy, interp, objc, objv) if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, - "?--? ?-nocomplain? ?varName varName ...?"); + "?-nocomplain? ?--? ?varName varName ...?"); return TCL_ERROR; } /* - * Very simple, restrictive argument parsing. The only options are - * -- and -nocomplain (which must come first to be an option). + * Simple, restrictive argument parsing. The only options are -- + * and -nocomplain (which must come first and be given exactly to + * be an option). */ i = 1; name = TclGetString(objv[i]); - if ((name[0] == '-') && (strcmp("-nocomplain", name) == 0)) { - flags = 0; - i++; - name = TclGetString(objv[i]); - } - if ((name[0] == '-') && (strcmp("--", name) == 0)) { - i++; + if (name[0] == '-') { + if (strcmp("-nocomplain", name) == 0) { + i++; + if (i == objc) { + return TCL_OK; + } + flags = 0; + name = TclGetString(objv[i]); + } + if (strcmp("--", name) == 0) { + i++; + } } for (; i < objc; i++) { |