- 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:
16
mumoconf.c
16
mumoconf.c
@ -209,7 +209,7 @@ int MakeMulti(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pNew->name = strdup(argv[1]);
|
||||
iRet = AddCommand(pSics, argv[1], ConfigMulti, NULL, pNew);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: duplicate command %s not created", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: duplicate command %s not created", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -227,7 +227,7 @@ static int ParseAlias(SicsInterp * pSics, psParser pPP, pMulMot self,
|
||||
/* next token should be a motor name */
|
||||
iToken = GetNextToken(pPP);
|
||||
if (iToken != SYMBOL) {
|
||||
sprintf(pError, "ERROR: Token %s not recognized in MulMot alias",
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: Token %s not recognized in MulMot alias",
|
||||
pPP->Token);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 0;
|
||||
@ -235,7 +235,7 @@ static int ParseAlias(SicsInterp * pSics, psParser pPP, pMulMot self,
|
||||
/* try find the motor and verify that it is a motor */
|
||||
pMot = FindMotor(pSics, pPP->Token);
|
||||
if (!pMot) {
|
||||
sprintf(pError, "ERROR: Motor %s not found, no alias created",
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: Motor %s not found, no alias created",
|
||||
pPP->Token);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 0;
|
||||
@ -248,7 +248,7 @@ static int ParseAlias(SicsInterp * pSics, psParser pPP, pMulMot self,
|
||||
iToken = GetNextToken(pPP);
|
||||
}
|
||||
if (iToken != SYMBOL) {
|
||||
sprintf(pError, "ERROR: Token %s not recognized in MulMot alias",
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: Token %s not recognized in MulMot alias",
|
||||
pPP->Token);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 0;
|
||||
@ -273,7 +273,7 @@ static int ParsePos(SicsInterp * pSics, psParser pPP,
|
||||
|
||||
iToken = GetNextToken(pPP);
|
||||
if (iToken != SYMBOL) { /* we want a name here */
|
||||
sprintf(pError, "ERROR: Invalid Token %s in ParsePos", pPP->Token);
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: Invalid Token %s in ParsePos", pPP->Token);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -304,7 +304,7 @@ int ConfigMulti(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
iRet = Arg2Text(argc, argv, pBueffel, 511);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "Argument string to long for %s configuration",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "Argument string to long for %s configuration",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -336,7 +336,7 @@ int ConfigMulti(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return ParsePos(pSics, &PP, self, pCon);
|
||||
break;
|
||||
default:
|
||||
sprintf(pError, "ERROR: Invalid Token %s found in %s",
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: Invalid Token %s found in %s",
|
||||
PP.Token, argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -344,7 +344,7 @@ int ConfigMulti(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
iToken = GetNextToken(&PP);
|
||||
}
|
||||
/* should never end here */
|
||||
sprintf(pError, "ERROR: %s was NOT understood in mumoconf", pBueffel);
|
||||
snprintf(pError,sizeof(pError)-1, "ERROR: %s was NOT understood in mumoconf", pBueffel);
|
||||
SCWrite(pCon, pError, eError);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user