- 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:
20
nxutil.c
20
nxutil.c
@ -31,7 +31,7 @@ int SNXSPutMotor(SicsInterp * pSics, SConnection * pCon,
|
||||
strtolower(pBueffel);
|
||||
pMot = FindMotor(pSics, pBueffel);
|
||||
if (!pMot) {
|
||||
sprintf(pBueffel, "WARNING: cannot find motor %s", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: cannot find motor %s", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
return 0;
|
||||
}
|
||||
@ -61,7 +61,7 @@ int SNXSPutMotorNull(SicsInterp * pSics, SConnection * pCon,
|
||||
strtolower(pBueffel);
|
||||
pMot = FindMotor(pSics, pBueffel);
|
||||
if (!pMot) {
|
||||
sprintf(pBueffel, "WARNING: cannot find motor %s", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: cannot find motor %s", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
return 0;
|
||||
}
|
||||
@ -69,7 +69,7 @@ int SNXSPutMotorNull(SicsInterp * pSics, SConnection * pCon,
|
||||
/* get the null point */
|
||||
iRet = MotorGetPar(pMot, "softzero", &fVal);
|
||||
if (!iRet) { /* should have been reported */
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1,
|
||||
"WARNING: failed to find zero point for motor %s", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
return 0;
|
||||
@ -96,7 +96,7 @@ int SNXSPutVariable(SicsInterp * pSics, SConnection * pCon,
|
||||
strtolower(pBueffel);
|
||||
pVar = FindVariable(pSics, pBueffel);
|
||||
if (!pVar) {
|
||||
sprintf(pBueffel, "WARNING: cannot find variable %s", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: cannot find variable %s", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
return 0;
|
||||
}
|
||||
@ -232,25 +232,25 @@ int SNXSPutEVVar(NXhandle hfil, NXdict pDict,
|
||||
}
|
||||
|
||||
if (fMean < -110) {
|
||||
sprintf(pBueffel, "WARNING: %s invalid", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s invalid", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
}
|
||||
if (pStdDevAlias) {
|
||||
if (fStdDev < -110) {
|
||||
sprintf(pBueffel, "WARNING: %s standard deviation invalid", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s standard deviation invalid", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
}
|
||||
}
|
||||
/* whatever it was, write it, even if it is shit */
|
||||
iRet = NXDputalias(hfil, pDict, pValAlias, &fMean);
|
||||
if (iRet != NX_OK) {
|
||||
sprintf(pBueffel, "WARNING: failed to write %s", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: failed to write %s", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
}
|
||||
if (pStdDevAlias) {
|
||||
iRet = NXDputalias(hfil, pDict, pStdDevAlias, &fStdDev);
|
||||
if (iRet != NX_OK) {
|
||||
sprintf(pBueffel, "WARNING: failed to write %s standard deviation",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: failed to write %s standard deviation",
|
||||
pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
}
|
||||
@ -275,7 +275,7 @@ int SNXSPutDrivable(SicsInterp * pSics, SConnection * pCon,
|
||||
if (pDriv) { /* it is drivable */
|
||||
fVal = pDriv->GetValue(pCom->pData, pCon);
|
||||
} else {
|
||||
sprintf(pBueffel, "ERROR: %s is not driveable, not written", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is not driveable, not written", pName);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -284,7 +284,7 @@ int SNXSPutDrivable(SicsInterp * pSics, SConnection * pCon,
|
||||
/* whatever it was, write it, even if it is shit */
|
||||
iRet = NXDputalias(hfil, pDict, pAlias, &fVal);
|
||||
if (iRet != NX_OK) {
|
||||
sprintf(pBueffel, "WARNING: failed to write %s", pName);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: failed to write %s", pName);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user