- 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:
@ -144,7 +144,7 @@ int InitServer(char *file, pServer * pServ)
|
||||
pPtr = IFindOption(pSICSOptions, "RedirectFile");
|
||||
if (pPtr != NULL) {
|
||||
myPid = getpid();
|
||||
sprintf(pBueffel, "%s%5.5d.log", pPtr, (int) myPid);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s%5.5d.log", pPtr, (int) myPid);
|
||||
fp = freopen(pBueffel, "w", stdout);
|
||||
if (!fp) {
|
||||
printf("Failed to redirect stdout/stderr to %s\n", pBueffel);
|
||||
@ -291,7 +291,7 @@ void StopServer(pServer self)
|
||||
strcpy(pBueffel, "Backup ");
|
||||
pText = IFindOption(pSICSOptions, "statusfile");
|
||||
if (pText) {
|
||||
strcat(pBueffel, pText);
|
||||
strncat(pBueffel, pText,511);
|
||||
} else {
|
||||
strcat(pBueffel, DEFAULTSTATUSFILE);
|
||||
}
|
||||
@ -440,7 +440,7 @@ int UserWait(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pTask = GetTasker();
|
||||
|
||||
if (argc < 2) {
|
||||
sprintf(pBueffel, "Insufficient number of args to %s", argv[0]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "Insufficient number of args to %s", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -448,7 +448,7 @@ int UserWait(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* try convert to a number */
|
||||
i = sscanf(argv[1], "%f", &fVal);
|
||||
if (i < 1) {
|
||||
sprintf(pBueffel, "Expected numeric argument to %s, got %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "Expected numeric argument to %s, got %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user