Commit 6d747054 authored by John Douglas Veitch's avatar John Douglas Veitch
Browse files

Fix some more string truncations. refs #6000

parent 9854b5b9
......@@ -888,8 +888,8 @@ void LALInferenceNestedSamplingAlgorithm(LALInferenceRunState *runState)
s=initNSintegralState(Nruns,Nlive);
/* Check for an interrupted run */
char resumefilename[FILENAME_MAX];
sprintf(resumefilename,"%s_resume",outfile);
char resumefilename[FILENAME_MAX+10];
snprintf(resumefilename,sizeof(resumefilename),"%s_resume",outfile);
int retcode=1;
if(LALInferenceGetProcParamVal(runState->commandLine,"--resume")){
#ifdef HAVE_HDF5
......@@ -986,8 +986,8 @@ void LALInferenceNestedSamplingAlgorithm(LALInferenceRunState *runState)
if(!HDFOUTPUT)
{
FILE *lout=NULL;
char param_list[FILENAME_MAX];
sprintf(param_list,"%s_params.txt",outfile);
char param_list[FILENAME_MAX+16];
snprintf(param_list,sizeof(param_list),"%s_params.txt",outfile);
lout=fopen(param_list,"w");
LALInferenceFprintParameterHeaders(lout,runState->livePoints[0]);
fclose(lout);
......@@ -1142,7 +1142,7 @@ void LALInferenceNestedSamplingAlgorithm(LALInferenceRunState *runState)
}
fclose(fpout);
char bayesfile[FILENAME_MAX];
char bayesfile[FILENAME_MAX+10];
sprintf(bayesfile,"%s_B.txt",outfile);
fpout=fopen(bayesfile,"w");
fprintf(fpout,"%lf %lf %lf %lf\n",logZ-logZnoise,logZ,logZnoise,logLmax);
......
......@@ -100,7 +100,7 @@ void LALInferenceInjectBurstSignal(LALInferenceIFOData *IFOdata, ProcessParamsTa
LALInferenceIFOData *thisData=IFOdata->next;
REAL8 minFlow=IFOdata->fLow;
REAL8 MindeltaT=IFOdata->timeData->deltaT;
char SNRpath[FILENAME_MAX]="";
char SNRpath[FILENAME_MAX+10]="";
while(thisData){
minFlow = minFlow>thisData->fLow ? thisData->fLow : minFlow;
MindeltaT = MindeltaT>thisData->timeData->deltaT ? thisData->timeData->deltaT : MindeltaT;
......@@ -119,9 +119,9 @@ void LALInferenceInjectBurstSignal(LALInferenceIFOData *IFOdata, ProcessParamsTa
ppt = LALInferenceGetProcParamVal(commandLine,"--outfile");
if (ppt)
sprintf(SNRpath, "%s_snr.txt", ppt->value);
snprintf(SNRpath, sizeof(SNRpath), "%s_snr.txt", ppt->value);
else
sprintf(SNRpath, "snr.txt");
snprintf(SNRpath, sizeof(SNRpath), "snr.txt");
injTable=XLALSimBurstTableFromLIGOLw(LALInferenceGetProcParamVal(commandLine,"--binj")->value,0,0);
REPORTSTATUS(&status);
......@@ -318,14 +318,14 @@ void InjectBurstFD(LALInferenceIFOData *IFOdata, SimBurst *inj_table, ProcessPar
LALStatus status;
memset(&status,0,sizeof(LALStatus));
INT4 errnum;
char SNRpath[FILENAME_MAX];
char SNRpath[FILENAME_MAX+16];
ProcessParamsTable *ppt=NULL;
ppt = NULL;
ppt = LALInferenceGetProcParamVal(commandLine,"--outfile");
if (ppt)
sprintf(SNRpath, "%s_snr.txt", ppt->value);
snprintf(SNRpath,sizeof(SNRpath), "%s_snr.txt", ppt->value);
else
sprintf(SNRpath, "snr.txt");
snprintf(SNRpath,sizeof(SNRpath), "snr.txt");
//REAL8 WinNorm = sqrt(IFOdata->window->sumofsquares/IFOdata->window->data->length);
BurstApproximant approx = XLALGetBurstApproximantFromString(inj_table->waveform);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment