From 5ad9795bd835d4065e7b32c94f1f8a3a49a0ec3d Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sun, 19 Jan 2014 16:31:26 +0000 Subject: [PATCH] Cleanup some potential memory overruns cmr=v1.7.5:reviewer=jsquyres This commit was SVN r30331. --- orte/mca/iof/base/iof_base_output.c | 4 ++-- orte/util/regex.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/orte/mca/iof/base/iof_base_output.c b/orte/mca/iof/base/iof_base_output.c index 62a741517e..60ab0c0456 100644 --- a/orte/mca/iof/base/iof_base_output.c +++ b/orte/mca/iof/base/iof_base_output.c @@ -243,12 +243,12 @@ construct: } } } - if (!endtagged) { + if (!endtagged && k < ORTE_IOF_BASE_TAGGED_OUT_MAX) { /* need to add an endtag */ for (j=0; j < endtaglen && k < ORTE_IOF_BASE_TAGGED_OUT_MAX-1; j++) { output->data[k++] = endtag[j]; } - output->data[k++] = '\n'; + output->data[k] = '\n'; } output->numbytes = k; diff --git a/orte/util/regex.c b/orte/util/regex.c index f1d0c024cb..6dc2da720e 100644 --- a/orte/util/regex.c +++ b/orte/util/regex.c @@ -522,6 +522,10 @@ static int regex_parse_node_range(char *base, char *range, int num_digits, char bool found; int ret; + if (NULL == base || NULL == range) { + return ORTE_ERROR; + } + len = strlen(range); base_len = strlen(base); /* Silence compiler warnings; start and end are always assigned