add check that allows only %f and %g conversions in variable format strings
This commit is contained in:
@ -38,6 +38,7 @@
|
||||
#include "memory.h"
|
||||
#include "info.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
@ -383,6 +384,8 @@ void Variable::set(int narg, char **arg)
|
||||
num[nvar] = 3;
|
||||
which[nvar] = 0;
|
||||
pad[nvar] = 0;
|
||||
if (!utils::strmatch(arg[2],"%[0-9 ]*\\.[0-9]+[fg]"))
|
||||
error->all(FLERR,"Incorrect conversion in format string");
|
||||
data[nvar] = new char*[num[nvar]];
|
||||
copy(2,&arg[2],data[nvar]);
|
||||
data[nvar][2] = new char[VALUELENGTH];
|
||||
|
||||
Reference in New Issue
Block a user