- After a bug at TRICS I replaced all occurrences of strcpy, strcat, sprintf
by length limited versions wherever appropriate.
This commit is contained in:
12
sanswave.c
12
sanswave.c
@ -275,14 +275,14 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* the last arument must denote a velocity selector */
|
||||
pCom = FindCommand(pSics, argv[2]);
|
||||
if (!pCom) {
|
||||
sprintf(pBueffel, "ERROR: velocity selector %s NOT found", argv[2]);
|
||||
snprintf(pBueffel,511, "ERROR: velocity selector %s NOT found", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillSANSWave(pNew);
|
||||
return 0;
|
||||
}
|
||||
pNew->pSelector = pCom->pData;
|
||||
if (!pNew->pSelector) {
|
||||
sprintf(pBueffel, "ERROR: velocity selector %s is invalid", argv[2]);
|
||||
snprintf(pBueffel,511, "ERROR: velocity selector %s is invalid", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillSANSWave(pNew);
|
||||
return 0;
|
||||
@ -290,7 +290,7 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pDum = (pDummy) pNew->pSelector;
|
||||
if (strcmp(pDum->pDescriptor->name, "VelocitySelector") != 0
|
||||
&& strcmp(pDum->pDescriptor->name,"NVS") != 0) {
|
||||
sprintf(pBueffel, "ERROR: velocity selector %s is invalid", argv[2]);
|
||||
snprintf(pBueffel,511, "ERROR: velocity selector %s is invalid", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillSANSWave(pNew);
|
||||
return 0;
|
||||
@ -315,7 +315,7 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* install command */
|
||||
iRet = AddCommand(pSics, argv[1], SANSWaveAction, KillSANSWave, pNew);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: duplicate command %s NOT created", argv[1]);
|
||||
snprintf(pBueffel,511, "ERROR: duplicate command %s NOT created", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillSANSWave(pNew);
|
||||
return 0;
|
||||
@ -349,7 +349,7 @@ int SANSWaveAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* the second argument must be a number */
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[2], &dNum);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: cannot convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,255, "ERROR: cannot convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -365,7 +365,7 @@ int SANSWaveAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel, "ERROR: subcommand %s NOT understood", argv[1]);
|
||||
snprintf(pBueffel,255, "ERROR: subcommand %s NOT understood", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user