From b95d1d8da760d219f10f5a8a7188cdc20d8a36d9 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 4 Sep 2006 12:03:53 +1000 Subject: [PATCH] Check number of args on scan run and silent commands to prevent segfaults. r1103 | ffr | 2006-09-04 12:03:53 +1000 (Mon, 04 Sep 2006) | 2 lines --- scan.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scan.c b/scan.c index 4911cef9..4ed66ad9 100644 --- a/scan.c +++ b/scan.c @@ -1540,7 +1540,7 @@ static int PrintCountsOrMonitors(pScanData self, SConnection *pCon, if(iWhich < 0) { GetScanCounts(self,lData,self->iNP); - snprintf(pBueffel,59,"%s.counts = {", name); + snprintf(pBueffel,59,"%s.Counts = {", name); } else { @@ -2133,6 +2133,11 @@ static int DumpScan(pScanData self, SConnection *pCon) /*---------- scan */ else if(strcmp(argv[1],"run") == 0) { + if (argc < 5) { + sprintf(pBueffel,"ERROR: not enough arguments for %s run",argv[0]); + SCWrite(pCon,pBueffel,eError); + return 0; + } /* get NP */ iRet = Tcl_GetInt(InterpGetTcl(pSics),argv[2],&lNP); if(iRet != TCL_OK) @@ -2181,6 +2186,11 @@ static int DumpScan(pScanData self, SConnection *pCon) /*---------- silent */ else if(strcmp(argv[1],"silent") == 0) { + if (argc < 5) { + sprintf(pBueffel,"ERROR: not enough arguments for %s silent",argv[0]); + SCWrite(pCon,pBueffel,eError); + return 0; + } /* get NP */ iRet = Tcl_GetInt(InterpGetTcl(pSics),argv[2],&lNP); if(iRet != TCL_OK)