From e2223cd9bf9396f77865bf284ffffc4b09d8049c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 24 Feb 2015 06:49:03 -0500 Subject: [PATCH] plm_rsh: ensure cwd array is \0-terminated This was CID 72257 --- orte/mca/plm/rsh/plm_rsh_component.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/orte/mca/plm/rsh/plm_rsh_component.c b/orte/mca/plm/rsh/plm_rsh_component.c index f5680f75bc..83d2006d11 100644 --- a/orte/mca/plm/rsh/plm_rsh_component.c +++ b/orte/mca/plm/rsh/plm_rsh_component.c @@ -14,7 +14,7 @@ * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights * reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -319,7 +319,8 @@ char **orte_plm_rsh_search(const char* agent_list, const char *path) if (NULL == path) { getcwd(cwd, OPAL_PATH_MAX); } else { - strncpy(cwd, path, OPAL_PATH_MAX); + strncpy(cwd, path, OPAL_PATH_MAX - 1); + cwd[OPAL_PATH_MAX - 1] = '\0'; } if (NULL == agent_list) { lines = opal_argv_split(mca_plm_rsh_component.agent, ':');