Skip to content

Commit

Permalink
Merge pull request #60 from visit-dav/task/BradWhitlock/2019_2_7_fix_…
Browse files Browse the repository at this point in the history
…libsim_crash

Fix BAD Libsim crash that would happen when first starting the engine…
  • Loading branch information
Brad Whitlock committed Feb 8, 2019
2 parents 38ef2da + f3a440d commit 994b5a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sim/V2/lib/VisItControlInterface_V2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,9 @@ static int GetConnectionParameters(VISIT_SOCKET desc)
* Brad Whitlock, Tue Nov 11 17:32:10 PST 2014
* Get batch mode options from visit_options string.
*
* Brad Whitlock, Thu Feb 7 18:01:53 PST 2019
* Fix buffer size allocation to prevent a crash.
*
*******************************************************************************/

static int CreateEngine(int batch)
Expand Down Expand Up @@ -1312,16 +1315,17 @@ static int CreateEngine(int batch)
*/
if(engine_argc == 0)
{
size_t argv_size = LIBSIM_MAX_STRING_LIST_SIZE * sizeof(char *);
engine_argc = 1;
engine_argv = (char **)malloc(LIBSIM_MAX_STRING_LIST_SIZE * sizeof(char));
memset(engine_argv, 0, sizeof(char*)*LIBSIM_MAX_STRING_LIST_SIZE);
engine_argv = (char **)malloc(argv_size);
memset(engine_argv, 0, argv_size);
engine_argv[0] = strdup("/usr/gapps/visit/bin/visit");
#if 1
if(visit_options != NULL)
{
char *start, *end, *tmpstr;
start = end = visit_options;
tmpstr = (char *)malloc(LIBSIM_MAX_STRING_SIZE * sizeof(char));
tmpstr = (char *)malloc(argv_size);
while(start != NULL)
{
int len = 0;
Expand Down

0 comments on commit 994b5a1

Please sign in to comment.