Commit 42793787 authored by David Gobbi's avatar David Gobbi
Browse files

Fix off-by-one memory write for wrapper -D args.

The wrapper tools were writing past the end of a malloc'd string in the
code that handles "-D" arguments.
parent ff41bfc5
Pipeline #2484 passed with stage
......@@ -12208,8 +12208,8 @@ void vtkParse_DefineMacro(const char *name, const char *definition)
definition = "";
}
l = n + strlen(definition) + 3;
cp = (char *)malloc(l);
l = n + strlen(definition) + 2;
cp = (char *)malloc(l + 1);
cp[0] = 'D';
strncpy(&cp[1], name, n);
cp[n+1] = '\0';
......
......@@ -4810,8 +4810,8 @@ void vtkParse_DefineMacro(const char *name, const char *definition)
definition = "";
}
l = n + strlen(definition) + 3;
cp = (char *)malloc(l);
l = n + strlen(definition) + 2;
cp = (char *)malloc(l + 1);
cp[0] = 'D';
strncpy(&cp[1], name, n);
cp[n+1] = '\0';
......
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