- 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:
koennecke
2009-12-04 12:58:31 +00:00
parent 297f9f2e02
commit 8cc5474334
80 changed files with 899 additions and 881 deletions

20
tclev.c
View File

@@ -35,7 +35,7 @@ static int TclSetValue(pEVDriver self, float fNew)
assert(pPriv);
/* build command line */
sprintf(pBueffel, "%s %s %f", pPriv->pSetValue, pPriv->pArray, fNew);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s %f", pPriv->pSetValue, pPriv->pArray, fNew);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
strncpy(pBueffel, pPriv->pTcl->result, 1023);
@@ -62,7 +62,7 @@ static int TclGetValue(pEVDriver self, float *fVal)
assert(pPriv);
/* build command line */
sprintf(pBueffel, "%s %s", pPriv->pGetValue, pPriv->pArray);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s", pPriv->pGetValue, pPriv->pArray);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
strncpy(pBueffel, pPriv->pTcl->result, 1023);
@@ -103,7 +103,7 @@ static int TclSend(pEVDriver self, char *pCommand,
assert(pPriv);
/* build command line */
sprintf(pBueffel, "%s %s %s", pPriv->pSend, pPriv->pArray, pCommand);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s %s", pPriv->pSend, pPriv->pArray, pCommand);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
strncpy(pBueffel, pPriv->pTcl->result, 1023);
@@ -137,7 +137,7 @@ static int TclGetError(pEVDriver self, int *iCode,
/* catch the stupid Tcl thing */
if (pPriv->iLastError == STUPIDTCL) {
sprintf(pBueffel,
snprintf(pBueffel,sizeof(pBueffel)-1,
"Your Tcl-script returned a stupid answer:\n --> %s <--",
pPriv->pTcl->result);
strncpy(pReply, pBueffel, iReplyLen);
@@ -145,7 +145,7 @@ static int TclGetError(pEVDriver self, int *iCode,
}
/* build command line */
sprintf(pBueffel, "%s %s %d", pPriv->pGetError, pPriv->pArray,
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s %d", pPriv->pGetError, pPriv->pArray,
pPriv->iLastError);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
@@ -181,7 +181,7 @@ static int TclTryFixIt(pEVDriver self, int iCode)
}
/* build command line */
sprintf(pBueffel, "%s %s %d", pPriv->pTryFixIt, pPriv->pArray, iCode);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s %d", pPriv->pTryFixIt, pPriv->pArray, iCode);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
return DEVFAULT;
@@ -211,7 +211,7 @@ static int TclInit(pEVDriver self)
assert(pPriv);
/* build command line */
sprintf(pBueffel, "%s %s", pPriv->pInit, pPriv->pArray);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s", pPriv->pInit, pPriv->pArray);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
strncpy(pBueffel, pPriv->pTcl->result, 1023);
@@ -237,7 +237,7 @@ static int TclClose(pEVDriver self)
assert(pPriv);
/* build command line */
sprintf(pBueffel, "%s %s", pPriv->pClose, pPriv->pArray);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s", pPriv->pClose, pPriv->pArray);
iRet = Tcl_Eval(pPriv->pTcl, pBueffel);
if (iRet != TCL_OK) {
strncpy(pBueffel, pPriv->pTcl->result, 1023);
@@ -426,7 +426,7 @@ int UpdateTclVariable(pEVDriver self, char *name, float fVal)
pPriv = (pTclEv) self->pPrivate;
assert(pPriv);
sprintf(pBueffel, "%f", fVal);
snprintf(pBueffel,sizeof(pBueffel)-1, "%f", fVal);
pPtr = Tcl_SetVar2(pPriv->pTcl, pPriv->pArray, name,
pBueffel, TCL_GLOBAL_ONLY);
if (pPtr == NULL) {
@@ -451,7 +451,7 @@ int TclEnvironmentWrapper(SConnection * pCon, SicsInterp * pSics,
assert(pPriv);
/* build command line */
sprintf(pBueffel, "%s %s", pPriv->pWrapper, pPriv->pArray);
snprintf(pBueffel,sizeof(pBueffel)-1, "%s %s", pPriv->pWrapper, pPriv->pArray);
for (i = 1; i < argc; i++) {
if ((strlen(pBueffel) + strlen(argv[i])) < MAXLEN) {
strcat(pBueffel, " ");