- After a bug at TRICS I replaced all occurrences of strcpy, strcat, sprintf
by length limited versions wherever appropriate. SKIPPED: psi/el755driv.c psi/faverage.c psi/frame.c psi/lmd200.c psi/polterwrite.c psi/psi.c psi/sanswave.c psi/sinqhmdriv.c psi/termprot.c
This commit is contained in:
18
maximize.c
18
maximize.c
@ -87,7 +87,7 @@ static int maxDrive(void *pObject, char *pVarName,
|
||||
pVarName, pDum->pDescriptor, pObject, pCon,
|
||||
RUNDRIVE, fPos);
|
||||
if (!status) {
|
||||
sprintf(pBueffel, "ERROR: failed to start %s", pVarName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: failed to start %s", pVarName);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -180,7 +180,7 @@ start:
|
||||
return 0;
|
||||
}
|
||||
/* print a message */
|
||||
sprintf(pBueffel, "%5d %8.2f %ld", i, x[i], lCts);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%5d %8.2f %ld", i, x[i], lCts);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
|
||||
/* store counts and some logic */
|
||||
@ -243,7 +243,7 @@ start:
|
||||
return 0;
|
||||
}
|
||||
/* print a message */
|
||||
sprintf(pBueffel, "%5d %8.2f %ld", i, x[i], lCts);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%5d %8.2f %ld", i, x[i], lCts);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
|
||||
/* store counts and some logic */
|
||||
@ -299,7 +299,7 @@ start:
|
||||
return 0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
sprintf(pBueffel, "iBot = %d, iTop = %d, lMax = %ld", iBot, iTop, lMax);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "iBot = %d, iTop = %d, lMax = %ld", iBot, iTop, lMax);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
#endif
|
||||
|
||||
@ -336,7 +336,7 @@ start:
|
||||
}
|
||||
}
|
||||
maxDrive(pVar, pVarName, fCent, pCon);
|
||||
sprintf(pBueffel, "Found peak center at %8.2f, Count = %ld", fCent,
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "Found peak center at %8.2f, Count = %ld", fCent,
|
||||
lCts);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
@ -462,19 +462,19 @@ int MaximizeAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* decode arguments */
|
||||
pCom = FindCommand(pSics, argv[1]);
|
||||
if (!pCom) {
|
||||
sprintf(pBueffel, "ERROR: object %s NOT found!", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: object %s NOT found!", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
if (!pCom->pData) {
|
||||
sprintf(pBueffel, "ERROR: object %s Invalid!!", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: object %s Invalid!!", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[2], &dVal);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: failed to convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: failed to convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -482,7 +482,7 @@ int MaximizeAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[4], &dVal);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: failed to convert %s to number", argv[4]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: failed to convert %s to number", argv[4]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user