- replaced sprintf by snprintf after appearance of a buf

This commit is contained in:
zolliker
2011-08-05 07:09:06 +00:00
parent 8162f117bd
commit b0fca0f96f

View File

@ -92,7 +92,7 @@ int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[])
{
pEVControl self = NULL;
char pBueffel[256], result[1024], *res;
char pBueffel[1024], result[1024], *res;
int iRet;
pEVDriver pD;
pTecsDriv pMe;
@ -170,7 +170,7 @@ int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
goto Error;
fVal = atof(result);
if (argc == 3 && atof(argv[2]) > fVal) {
sprintf(pBueffel,
snprintf(pBueffel, sizeof pBueffel,
"WARNING: upper limit reduced to maximal allowed value: %g",
fVal);
SCWrite(pCon, pBueffel, eWarning);
@ -185,7 +185,8 @@ int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
iRet = 1;
}
if (iRet) {
sprintf(pBueffel, "%s.%s = %s\n", self->pName, argv[1], result);
snprintf(pBueffel, sizeof pBueffel,
"%s.%s = %s\n", self->pName, argv[1], result);
SCWrite(pCon, pBueffel, eValue);
}
return iRet;
@ -220,7 +221,8 @@ int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
}
if (iRet < 0)
goto Error;
sprintf(pBueffel, "%s.%s = %s\n", self->pName, argv[1], result);
snprintf(pBueffel, sizeof pBueffel,
"%s.%s = %s\n", self->pName, argv[1], result);
SCWrite(pCon, pBueffel, eValue);
return 1;
}