- 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
macro.c
18
macro.c
@@ -467,7 +467,7 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
||||
}
|
||||
fp = fopen(argv[1], "r");
|
||||
if (!fp) {
|
||||
sprintf(pBueffel, " Failed to open file -> %s <- ", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, " Failed to open file -> %s <- ", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
||||
SetStatus(eEager);
|
||||
FirstWord(pCom, pBueffel);
|
||||
if (FindCommand(pInter, pBueffel) != NULL) {
|
||||
sprintf(pBueffel, "%s:%d>> %s", pFile, iLine, pCom);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s:%d>> %s", pFile, iLine, pCom);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
if (pWhere != NULL) {
|
||||
free(pWhere);
|
||||
@@ -928,7 +928,7 @@ static int TclAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pTcl = InterpGetTcl(pSics);
|
||||
|
||||
if (!SCMatchRights(pCon, self->iUser)) {
|
||||
sprintf(pBueffel, "ERROR: you are not authorised to invoke %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: you are not authorised to invoke %s",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@@ -976,7 +976,7 @@ int TclPublish(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/* check no of args */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: Insufficient no of arguments to %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: Insufficient no of arguments to %s",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@@ -985,7 +985,7 @@ int TclPublish(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* try convert last parameter to user code */
|
||||
iUser = decodeSICSPriv(argv[2]);
|
||||
if (iUser < 0) {
|
||||
sprintf(pBueffel, "ERROR: cannot identify %s as a valid user code",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: cannot identify %s as a valid user code",
|
||||
argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@@ -999,7 +999,7 @@ int TclPublish(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
/* check user rights */
|
||||
if (!SCMatchRights(pCon, usMugger)) {
|
||||
sprintf(pBueffel, "ERROR: you are not authorised to use %s", argv[0]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: you are not authorised to use %s", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ int TclPublish(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/* check user rights */
|
||||
if (!SCMatchRights(pCon, usMugger)) {
|
||||
sprintf(pBueffel, "ERROR: you are not authorised to use %s", argv[0]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: you are not authorised to use %s", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@@ -1017,14 +1017,14 @@ int TclPublish(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* do a job ! */
|
||||
pNew = CreatePublish(argv[1], iUser);
|
||||
if (!pNew) {
|
||||
sprintf(pBueffel, "ERROR: memory error in %s", argv[0]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: memory error in %s", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
iRet =
|
||||
AddCommand(pSics, argv[1], TclAction, DeletePublish, (void *) 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user