- 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:
@ -175,11 +175,11 @@ int GPIBAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
status = GPIBattach(self, boardID, address, secondaryAddress,
|
||||
tmo, eot, eoi);
|
||||
if (status > 0) {
|
||||
sprintf(pBuffer, "%d", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%d", status);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBuffer, "ERROR: error %d on attach", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "ERROR: error %d on attach", status);
|
||||
SCWrite(pCon, pBuffer, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -202,7 +202,7 @@ int GPIBAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBuffer, "ERROR: error %d on dettach", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "ERROR: error %d on dettach", status);
|
||||
SCWrite(pCon, pBuffer, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -243,7 +243,7 @@ int GPIBAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBuffer, "ERROR: error %d on send", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "ERROR: error %d on send", status);
|
||||
SCWrite(pCon, pBuffer, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -274,7 +274,7 @@ int GPIBAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBuffer, "ERROR: error %d on send", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "ERROR: error %d on send", status);
|
||||
SCWrite(pCon, pBuffer, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -297,7 +297,7 @@ int GPIBAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBuffer, "ERROR: error %d on read", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "ERROR: error %d on read", status);
|
||||
SCWrite(pCon, pBuffer, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -317,12 +317,12 @@ int GPIBAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
status = GPIBread(self, devID, &value, 4);
|
||||
if (status > 0) {
|
||||
sprintf(pBuffer, "gpib %d = %d", devID, value);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "gpib %d = %d", devID, value);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
/*
|
||||
sprintf(pBuffer,"ERROR: error %d on read", status);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1,"ERROR: error %d on read", status);
|
||||
SCWrite(pCon,pBuffer,eError);
|
||||
*/
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user