- 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:
18
xytable.c
18
xytable.c
@ -64,7 +64,7 @@ int XYFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
iRet = AddCommand(pSics, argv[1], XYAction, KillXY, pNew);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: duplicate command %s not created", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: duplicate command %s not created", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -148,7 +148,7 @@ int XYList(pXYTable self, SConnection * pCon)
|
||||
iRet = LLDnodePtr2First(self->iList);
|
||||
while (iRet != 0) {
|
||||
LLDnodeDataTo(self->iList, &pData);
|
||||
sprintf(pBueffel, " %12.4f %12.4f\n", pData.x, pData.y);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, " %12.4f %12.4f\n", pData.x, pData.y);
|
||||
strcat(pBuffer, pBueffel);
|
||||
iRet = LLDnodePtr2Next(self->iList);
|
||||
}
|
||||
@ -205,7 +205,7 @@ int XYAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
assert(pSics);
|
||||
|
||||
if (argc < 2) {
|
||||
sprintf(pBueffel, "ERROR: need command word for %s", argv[0]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: need command word for %s", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -223,21 +223,21 @@ int XYAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
if (argc < 4) {
|
||||
sprintf(pBueffel, "ERROR: insufficient no of args to %s add",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient no of args to %s add",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[2], &dVal);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: failed to conert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: failed to conert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
fX = (float) dVal;
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[3], &dVal);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: failed to conert %s to number", argv[3]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: failed to conert %s to number", argv[3]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -250,14 +250,14 @@ int XYAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient no of args to %s write",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient no of args to %s write",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
fd = fopen(argv[2], "w");
|
||||
if (fd == NULL) {
|
||||
sprintf(pBueffel, "ERROR: failed to open %s for writing", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: failed to open %s for writing", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -272,7 +272,7 @@ int XYAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
XYList(self, pCon);
|
||||
return 1;
|
||||
}
|
||||
sprintf(pBueffel, "ERROR: subcommand %s to %s unknonw",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: subcommand %s to %s unknonw",
|
||||
argv[1], argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user