- 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:
22
script.c
22
script.c
@@ -122,7 +122,7 @@ int SetSICSInterrupt(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
strtolower(argv[1]);
|
||||
iInt = Text2Interrupt(argv[1]);
|
||||
if (iInt < 0) {
|
||||
sprintf(pBueffel, "ERROR: %s not recognized as Interrupt code",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s not recognized as Interrupt code",
|
||||
argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@@ -179,7 +179,7 @@ int SetSICSStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel, "ERROR: %s not recognized as status code", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s not recognized as status code", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@@ -273,28 +273,28 @@ int SICSBounds(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* argv[1] should be drivable */
|
||||
pCom = FindCommand(pSics, argv[1]);
|
||||
if (!pCom) {
|
||||
sprintf(pBueffel, "ERROR: %s is no Sics Object", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is no Sics Object", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pDum = (Dummy *) pCom->pData;
|
||||
if (!pDum) {
|
||||
sprintf(pBueffel, "ERROR: %s is no valid Sics Object", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is no valid Sics Object", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pInt = pDum->pDescriptor->GetInterface(pDum, DRIVEID);
|
||||
if (!pInt) {
|
||||
sprintf(pBueffel, "ERROR: %s is not drivable!", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is not drivable!", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* argv[2] should be a numeric */
|
||||
if (!isNum(argv[2])) {
|
||||
sprintf(pBueffel, "ERROR: %s is not a number!", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is not a number!", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@@ -335,14 +335,14 @@ int SICSStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* argv[1] should be drivable */
|
||||
pCom = FindCommand(pSics, argv[1]);
|
||||
if (!pCom) {
|
||||
sprintf(pBueffel, "ERROR: %s is no Sics Object", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is no Sics Object", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pDum = (Dummy *) pCom->pData;
|
||||
if (!pDum) {
|
||||
sprintf(pBueffel, "ERROR: %s is no valid Sics Object", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is no valid Sics Object", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@@ -351,16 +351,16 @@ int SICSStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pCInt = pDum->pDescriptor->GetInterface(pDum, COUNTID);
|
||||
if (pDInt) {
|
||||
iRet = pDInt->CheckStatus(pDum, pCon);
|
||||
sprintf(pBueffel, "%d", iRet);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%d", iRet);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else if (pCInt) {
|
||||
iRet = pCInt->CheckCountStatus(pDum, pCon);
|
||||
sprintf(pBueffel, "%d", iRet);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%d", iRet);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel, "ERROR: %s is neither drivable nor countable",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is neither drivable nor countable",
|
||||
argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user