From fad43844635a991d144dfcec436763a13e7b62c9 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sat, 13 Sep 2014 02:23:30 +0000 Subject: [PATCH] Not sure how we could get to this point without having already detected the error, but just to be safe - check for end-of-array and return if error. Refs trac:4897 This commit was SVN r32731. The following Trac tickets were found above: Ticket 4897 --> https://svn.open-mpi.org/trac/ompi/ticket/4897 --- opal/mca/base/mca_base_cmd_line.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opal/mca/base/mca_base_cmd_line.c b/opal/mca/base/mca_base_cmd_line.c index 4c06726162..fe8f35f7e8 100644 --- a/opal/mca/base/mca_base_cmd_line.c +++ b/opal/mca/base/mca_base_cmd_line.c @@ -208,6 +208,12 @@ void mca_base_cmd_line_wrap_args(char **args) for (i=0; NULL != args && NULL != args[i]; i++) { if (0 == strcmp(args[i], "-mca") || 0 == strcmp(args[i], "--mca")) { + if (NULL == args[i+1] || NULL == args[i+2]) { + /* this should be impossible as the error would + * have been detected well before here, but just + * be safe */ + return; + } i += 2; asprintf(&tstr, "\"%s\"", args[i]); free(args[i]);