diff options
author | Adrián Medraño Calvo <adrian@medranocalvo.com> | 2017-07-27 15:51:15 (GMT) |
---|---|---|
committer | Adrián Medraño Calvo <adrian@medranocalvo.com> | 2017-07-27 15:51:17 (GMT) |
commit | 796f2e815904da90bf1d801493f34f4127848eaa (patch) | |
tree | 6ea3d9ef1f9d821f5011f7be6e939926025a2d50 | |
parent | dc04360d2fb2a2760e46aa2fbabe124e1ed5306f (diff) | |
download | blt-796f2e815904da90bf1d801493f34f4127848eaa.zip blt-796f2e815904da90bf1d801493f34f4127848eaa.tar.gz blt-796f2e815904da90bf1d801493f34f4127848eaa.tar.bz2 |
Make sure enough arguments are passed before accessing them
Would eventually segfault when invoking:
.g inside 0;
-rw-r--r-- | generic/tkbltGraphOp.C | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tkbltGraphOp.C b/generic/tkbltGraphOp.C index 6588d64..ada2758 100644 --- a/generic/tkbltGraphOp.C +++ b/generic/tkbltGraphOp.C @@ -228,7 +228,13 @@ topmargin, bottommargin, plotarea, or legend", (char*)NULL); static int InsideOp(ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[]) { + if (objc != 4) { + Tcl_WrongNumArgs(interp, 2, objv, "x y"); + return TCL_ERROR; + } + Graph* graphPtr = (Graph*)clientData; + int x; if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) return TCL_ERROR; |