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
This commit is contained in:
committed by
Douglas Clowes
parent
6ae1d3548d
commit
b95d1d8da7
12
scan.c
12
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)
|
||||
|
||||
Reference in New Issue
Block a user