- 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:
koennecke
2009-12-04 12:58:31 +00:00
parent 297f9f2e02
commit 8cc5474334
80 changed files with 899 additions and 881 deletions

View File

@@ -291,7 +291,7 @@ static void AutoLog(void)
CLFormatTime(pTime, 79);
/* build file name */
sprintf(pBueffel, "%s/auto%s.log", pPtr, pTime);
snprintf(pBueffel,1024, "%s/auto%s.log", pPtr, pTime);
/* open file */
fauto = fopen(pBueffel, "w");
@@ -302,7 +302,7 @@ static void AutoLog(void)
/* write the instrument name to it for identification */
pInst = FindVariable(pServ->pSics, "instrument");
if (pInst) {
sprintf(pBueffel, "Logfile started at instrument %s at %s",
snprintf(pBueffel,1024, "Logfile started at instrument %s at %s",
pInst->text, pTime);
WriteToCommandLog("SYS>>", pBueffel);
}
@@ -317,7 +317,7 @@ static void AutoLog(void)
}
SCnoSock(pIntern);
SCSetRights(pIntern, usUser);
sprintf(pBueffel, "fileeval %s", pPtr);
snprintf(pBueffel,1024, "fileeval %s", pPtr);
InterpExecute(pServ->pSics, pIntern, pBueffel);
SCDeleteConnection(pIntern);
}
@@ -448,19 +448,19 @@ int CommandLog(SConnection * pCon, SicsInterp * pSics, void *pData,
pPtr = IFindOption(pSICSOptions, "LogFileDir");
if (!pPtr) {
SCWrite(pCon, "WARNING: no log file directory specified", eWarning);
sprintf(pBueffel, "%s", argv[2]);
snprintf(pBueffel,1023, "%s", argv[2]);
} else {
sprintf(pBueffel, "%s/%s", pPtr, argv[2]);
snprintf(pBueffel,1023, "%s/%s", pPtr, argv[2]);
}
fd = fopen(pBueffel, "w");
if (!fd) {
sprintf(pBueffel, "ERROR: cannot open %s/%s for writing", pPtr,
snprintf(pBueffel,1023, "ERROR: cannot open %s/%s for writing", pPtr,
argv[2]);
SCWrite(pCon, pBueffel, eError);
return 0;
}
strcpy(pFile, argv[2]);
strncpy(pFile, argv[2],255);
SCSendOK(pCon);
return 1;
} else if (strcmp(argv[1], "auto") == 0) {
@@ -498,7 +498,7 @@ int CommandLog(SConnection * pCon, SicsInterp * pSics, void *pData,
SCSendOK(pCon);
return 1;
}
sprintf(pBueffel, "ERROR: subcommand %s to commandlog unknown", argv[1]);
snprintf(pBueffel, 1024,"ERROR: subcommand %s to commandlog unknown", argv[1]);
SCWrite(pCon, pBueffel, eError);
return 0;
}