aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2017-05-26 14:22:48 +1000
committerSteve Bennett <steveb@workware.net.au>2017-05-26 14:27:57 +1000
commit0858783cc469c095d7e6121d1fc5689760da841e (patch)
tree0d249bf186591772b5bcabde5b25832e6c7c1ba9 /jim.c
parentbd5139c89e714bb7e10a0da55d9a10f51e93516c (diff)
downloadjimtcl-0858783cc469c095d7e6121d1fc5689760da841e.zip
jimtcl-0858783cc469c095d7e6121d1fc5689760da841e.tar.gz
jimtcl-0858783cc469c095d7e6121d1fc5689760da841e.tar.bz2
scan: validate -ve XPG3 specifier
Reported-by: Ryan Whitworth <me@ryanwhitworth.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.c')
-rw-r--r--jim.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/jim.c b/jim.c
index f4e1d54..f070526 100644
--- a/jim.c
+++ b/jim.c
@@ -9516,6 +9516,11 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr)
return JIM_ERR;
}
}
+ if (descr->pos < 0) {
+ fmtObj->error =
+ "\"%n$\" conversion specifier is negative";
+ return JIM_ERR;
+ }
/* Try to find a width after the XPG3 specifier */
if (sscanf(fmt, "%d%n", &width, &skip) == 1) {
descr->width = width;