- 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:
14
lin2ang.c
14
lin2ang.c
@ -193,7 +193,7 @@ int MakeLin2Ang(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* check if we got a motor */
|
||||
pNew->lin = FindMotor(pSics, argv[2]);
|
||||
if (!pNew->lin) {
|
||||
sprintf(pBueffel, "ERROR: %s is no motor!", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is no motor!", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillL2A(pNew);
|
||||
return 0;
|
||||
@ -213,7 +213,7 @@ int MakeLin2Ang(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* install command */
|
||||
iRet = AddCommand(pSics, argv[1], Lin2AngAction, KillL2A, pNew);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1,
|
||||
"ERROR: duplicate Lin2Ang command %s NOT created", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
KillL2A(pNew);
|
||||
@ -239,7 +239,7 @@ int Lin2AngAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* without parameter: give value */
|
||||
if (argc < 2) {
|
||||
fVal = L2AGetValue(self, pCon);
|
||||
sprintf(pBueffel, "%s = %f", argv[0], fVal);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s = %f", argv[0], fVal);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 1;
|
||||
}
|
||||
@ -263,7 +263,7 @@ int Lin2AngAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel, "%s.length = %f", argv[0], self->length);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.length = %f", argv[0], self->length);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
@ -287,7 +287,7 @@ int Lin2AngAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel, "%s.softzero = %f", argv[0], self->zero);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.softzero = %f", argv[0], self->zero);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
@ -298,12 +298,12 @@ int Lin2AngAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
MotorGetPar(self->lin, "softlowerlim", &fLow);
|
||||
fHigh = x2ang(self, fHigh);
|
||||
fLow = x2ang(self, fLow);
|
||||
sprintf(pBueffel, "%s.limits: %f %f\n change through motor limits ",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.limits: %f %f\n change through motor limits ",
|
||||
argv[0], fLow, fHigh);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
sprintf(pBueffel, "ERROR: method %s not found!", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: method %s not found!", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user