add check that allows only %f and %g conversions in variable format strings
This commit is contained in:
@ -50,6 +50,7 @@
|
||||
#include "accelerator_kokkos.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
@ -526,6 +527,11 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
|
||||
*fmtflag='\0';
|
||||
}
|
||||
|
||||
// quick check for proper format string
|
||||
|
||||
if (!utils::strmatch(fmtstr,"%[0-9 ]*\\.[0-9]+[fg]"))
|
||||
error->all(FLERR,"Incorrect conversion in format string");
|
||||
|
||||
snprintf(immediate,256,fmtstr,variable->compute_equal(var));
|
||||
value = immediate;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user