- 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:
@ -244,7 +244,7 @@ static int EVIStatus(void *pData, SConnection * pCon)
|
||||
}
|
||||
|
||||
if (fPos < -990.) {
|
||||
sprintf(pBueffel, "ERROR: %s cannot read its current value",
|
||||
snprintf(pBueffel, 255, "ERROR: %s cannot read its current value",
|
||||
self->pName);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
self->eMode = EVIdle;
|
||||
@ -268,7 +268,7 @@ static int EVIStatus(void *pData, SConnection * pCon)
|
||||
tmo = (int) (ObVal(self->pParam, MAXWAIT));
|
||||
/* based on this: logic ! */
|
||||
if (tmo > 0 && now > self->start + tmo) { /* time out */
|
||||
sprintf(pBueffel, "ERROR: wait time limit reached on %s", self->pName);
|
||||
snprintf(pBueffel,255, "ERROR: wait time limit reached on %s", self->pName);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
self->eMode = EVMonitor;
|
||||
notifyStatus(self, pCon, HWIdle);
|
||||
@ -283,7 +283,7 @@ static int EVIStatus(void *pData, SConnection * pCon)
|
||||
if (self->lastt <= 0) { /* lastt negative: -seconds already waited */
|
||||
self->lastt += now;
|
||||
if (tmo > 0) {
|
||||
sprintf(pBueffel, "%s inside tolerance, wait %.2f sec to settle",
|
||||
snprintf(pBueffel,255, "%s inside tolerance, wait %.2f sec to settle",
|
||||
self->pName, (self->lastt + tmo - now) * 1.0);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
}
|
||||
@ -300,7 +300,7 @@ static int EVIStatus(void *pData, SConnection * pCon)
|
||||
} else {
|
||||
if (self->lastt > 0) { /* save time already waited */
|
||||
if (tmo > 0) {
|
||||
sprintf(pBueffel, "%s outside tolerance, settling time suspended",
|
||||
snprintf(pBueffel,255, "%s outside tolerance, settling time suspended",
|
||||
self->pName);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
}
|
||||
@ -379,7 +379,7 @@ static void ErrReport(pEVControl self)
|
||||
|
||||
self->pDriv->GetValues(self->pDriv, &self->fTarget, &fPos, &fDelta);
|
||||
if (self->iWarned == 0) {
|
||||
sprintf(pBueffel, "WARNING: %s is out of range by %g",
|
||||
snprintf(pBueffel, 255,"WARNING: %s is out of range by %g",
|
||||
self->pName, fDelta);
|
||||
ErrWrite(pBueffel, self->conn);
|
||||
self->iWarned = 1;
|
||||
@ -586,7 +586,7 @@ static int EVIIsInTolerance(void *pData)
|
||||
if (fDelta <= tol) {
|
||||
self->eMode = EVMonitor;
|
||||
if (self->iWarned) {
|
||||
sprintf(pBueffel, "Environment device %s back in tolerances again",
|
||||
snprintf(pBueffel,255, "Environment device %s back in tolerances again",
|
||||
self->pName);
|
||||
ErrWrite(pBueffel, self->conn);
|
||||
self->iWarned = 0;
|
||||
@ -598,7 +598,7 @@ static int EVIIsInTolerance(void *pData)
|
||||
/* deal with callbacks */
|
||||
self->callCount++;
|
||||
if (self->callCount >= 20) {
|
||||
sprintf(pBueffel, "%s = %g", self->pName, fPos);
|
||||
snprintf(pBueffel,255, "%s = %g", self->pName, fPos);
|
||||
InvokeCallBack(self->pCall, VALUECHANGE, pBueffel);
|
||||
self->callCount = 0;
|
||||
}
|
||||
@ -842,7 +842,7 @@ int EVCDrive(pEVControl self, SConnection * pCon, float fVal)
|
||||
iRet = StartDevice(GetExecutor(), self->pName, self->pDes,
|
||||
self, pCon, pCon->runLevel, fVal);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: Failure to start %s", self->pName);
|
||||
snprintf(pBueffel,255, "ERROR: Failure to start %s", self->pName);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1154,11 +1154,11 @@ int EVControlWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
iRet = EVCGetPar(self, argv[1], &fPos);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: parameter %s NOT found", argv[1]);
|
||||
snprintf(pBueffel,255, "ERROR: parameter %s NOT found", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
} else {
|
||||
sprintf(pBueffel, "%s.%s = %g", self->pName, argv[1], fPos);
|
||||
snprintf(pBueffel,255, "%s.%s = %g", self->pName, argv[1], fPos);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
@ -1196,7 +1196,7 @@ int EVControlWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[2], &dVal);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: %s no valid number", argv[2]);
|
||||
snprintf(pBueffel, 255,"ERROR: %s no valid number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1385,7 +1385,7 @@ static pEVControl InstallCommonControllers(SicsInterp * pSics,
|
||||
/* install command */
|
||||
iRet = AddCommand(pSics, argv[2], Wrapper, DeleteEVController, pNew);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: duplicate command %s not created", argv[2]);
|
||||
snprintf(pBueffel,511, "ERROR: duplicate command %s not created", argv[2]);
|
||||
DeleteEVController((void *) pNew);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return NULL;
|
||||
@ -1408,7 +1408,7 @@ int RemoveEVController(SConnection * pCon, char *name)
|
||||
EVUnregister(FindEMON(pServ->pSics), name);
|
||||
iRet = RemoveCommand(pServ->pSics, name);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: %s not found, NOT deleted", name);
|
||||
snprintf(pBueffel,511, "ERROR: %s not found, NOT deleted", name);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1474,7 +1474,7 @@ int EVControlFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel, 511,
|
||||
"ERROR: environment device %s already installed, delete first",
|
||||
argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
@ -1483,7 +1483,7 @@ int EVControlFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
pCom = FindCommand(pSics, argv[2]);
|
||||
if (pCom) {
|
||||
sprintf(pBueffel, "ERROR: command %s already exists", argv[2]);
|
||||
snprintf(pBueffel,511, "ERROR: command %s already exists", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1493,7 +1493,7 @@ int EVControlFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
if (site != NULL) {
|
||||
pNew = site->InstallEnvironmentController(pSics, pCon, argc, argv);
|
||||
} else {
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel,511,
|
||||
"ERROR: %s not recognized as a valid driver type",
|
||||
argv[3]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
|
Reference in New Issue
Block a user