From c4ea7a252a1205b0cbe5a1ac4cc47f0098d90af9 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 30 Nov 2011 23:33:59 +0000 Subject: [PATCH] Add a little protection against badly formed node names so we don't segfault if they are encountered This commit was SVN r25554. --- orte/mca/plm/base/plm_base_launch_support.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/orte/mca/plm/base/plm_base_launch_support.c b/orte/mca/plm/base/plm_base_launch_support.c index 8c823a55a2..5dbaacb235 100644 --- a/orte/mca/plm/base/plm_base_launch_support.c +++ b/orte/mca/plm/base/plm_base_launch_support.c @@ -467,6 +467,17 @@ static void process_orted_launch_report(int fd, short event, void *data) /* look this node up, if necessary */ if (!orte_plm_globals.daemon_nodes_assigned_at_launch) { + if (NULL == nodename) { + /* it is permissible to transmit a NULL string, but + * that would be a problem here + */ + opal_output(0, "%s NULL nodename returned by daemon %s - cannot process", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + ORTE_NAME_PRINT(&daemon->name)); + rc = ORTE_ERR_FATAL; + orted_failed_launch = true; + goto CLEANUP; + } len = strlen(nodename); for (idx=0; idx < orte_node_pool->size; idx++) { if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, idx))) { @@ -476,6 +487,14 @@ static void process_orted_launch_report(int fd, short event, void *data) /* already known */ continue; } + if (NULL == node->name) { + /* this shouldn't happen */ + opal_output(0, "%s NULL nodename detected during daemon callback - cannot process", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); + rc = ORTE_ERR_FATAL; + orted_failed_launch = true; + goto CLEANUP; + } if (len <= strlen(node->name)) { len2 = len; } else {