diff --git a/ompi/datatype/ompi_datatype_create.c b/ompi/datatype/ompi_datatype_create.c index cf04fd7d58..69ec1b2c6c 100644 --- a/ompi/datatype/ompi_datatype_create.c +++ b/ompi/datatype/ompi_datatype_create.c @@ -9,7 +9,7 @@ * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -108,8 +108,12 @@ ompi_datatype_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newTy the top level (specifically, MPI_TYPE_DUP). */ new_ompi_datatype->d_keyhash = NULL; new_ompi_datatype->args = NULL; - snprintf (new_ompi_datatype->name, MPI_MAX_OBJECT_NAME, "Dup %s", - oldType->name); + + char *new_name; + asprintf(&new_name, "Dup %s", oldType->name); + strncpy(new_ompi_datatype->name, new_name, MPI_MAX_OBJECT_NAME - 1); + new_ompi_datatype->name[MPI_MAX_OBJECT_NAME - 1] = '\0'; + free(new_name); return OMPI_SUCCESS; } diff --git a/ompi/mca/pml/v/pml_v_component.c b/ompi/mca/pml/v/pml_v_component.c index 650f681cc4..fce84fc228 100644 --- a/ompi/mca/pml/v/pml_v_component.c +++ b/ompi/mca/pml/v/pml_v_component.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2004-2015 The Trustees of the University of Tennessee. * All rights reserved. - * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 Research Organization for Information Science @@ -140,10 +140,15 @@ static int mca_pml_v_component_close(void) ompi_pml_v_output_close (); /* Mark that we have changed something */ - snprintf(mca_pml_base_selected_component.pmlm_version.mca_component_name, - MCA_BASE_MAX_TYPE_NAME_LEN, "%s]v%s", + char *new_name; + asprintf(&new_name, "%s]v%s", mca_pml_v.host_pml_component.pmlm_version.mca_component_name, mca_vprotocol_component.pmlm_version.mca_component_name); + size_t len = sizeof(mca_pml_base_selected_component.pmlm_version.mca_component_name); + strncpy(mca_pml_base_selected_component.pmlm_version.mca_component_name, + new_name, len - 1); + mca_pml_base_selected_component.pmlm_version.mca_component_name[len - 1] = '\0'; + free(new_name); /* Replace finalize */ mca_pml_base_selected_component.pmlm_finalize = diff --git a/ompi/mpi/c/type_create_f90_complex.c b/ompi/mpi/c/type_create_f90_complex.c index 91a1d08f33..e8ec6d6f9a 100644 --- a/ompi/mpi/c/type_create_f90_complex.c +++ b/ompi/mpi/c/type_create_f90_complex.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -107,8 +107,12 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype) */ datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; /* Mark the datatype as a special F90 convenience type */ - snprintf(datatype->name, MPI_MAX_OBJECT_NAME, "COMBINER %s", - (*newtype)->name); + char *new_name; + asprintf(&new_name, "COMBINER %s", (*newtype)->name); + size_t max_len = MPI_MAX_OBJECT_NAME; + strncpy(datatype->name, new_name, max_len - 1); + datatype->name[max_len - 1] = '\0'; + free(new_name); a_i[0] = &p; a_i[1] = &r; diff --git a/ompi/mpi/c/type_create_f90_integer.c b/ompi/mpi/c/type_create_f90_integer.c index 95df36e9ea..108893dfaa 100644 --- a/ompi/mpi/c/type_create_f90_integer.c +++ b/ompi/mpi/c/type_create_f90_integer.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -103,8 +103,12 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype) */ datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; /* Mark the datatype as a special F90 convenience type */ - snprintf(datatype->name, MPI_MAX_OBJECT_NAME, "COMBINER %s", - (*newtype)->name); + char *new_name; + asprintf(&new_name, "COMBINER %s", (*newtype)->name); + size_t max_len = MPI_MAX_OBJECT_NAME; + strncpy(datatype->name, new_name, max_len - 1); + datatype->name[max_len - 1] = '\0'; + free(new_name); a_i[0] = &r; ompi_datatype_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_INTEGER ); diff --git a/ompi/mpi/c/type_create_f90_real.c b/ompi/mpi/c/type_create_f90_real.c index 1825f625ab..de2ee83fac 100644 --- a/ompi/mpi/c/type_create_f90_real.c +++ b/ompi/mpi/c/type_create_f90_real.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -107,8 +107,12 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype) */ datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; /* Mark the datatype as a special F90 convenience type */ - snprintf(datatype->name, MPI_MAX_OBJECT_NAME, "COMBINER %s", - (*newtype)->name); + char *new_name; + asprintf(&new_name, "COMBINER %s", (*newtype)->name); + size_t max_len = MPI_MAX_OBJECT_NAME; + strncpy(datatype->name, new_name, max_len - 1); + datatype->name[max_len - 1] = '\0'; + free(new_name); ompi_datatype_set_args( datatype, 2, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_REAL ); diff --git a/opal/mca/rcache/base/rcache_base_vma_tree.c b/opal/mca/rcache/base/rcache_base_vma_tree.c index cd552bc379..37cac715c0 100644 --- a/opal/mca/rcache/base/rcache_base_vma_tree.c +++ b/opal/mca/rcache/base/rcache_base_vma_tree.c @@ -15,7 +15,7 @@ * Copyright (c) 2007 Mellanox Technologies. All rights reserved. * Copyright (c) 2009 IBM Corporation. All rights reserved. * Copyright (c) 2013 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -107,7 +107,6 @@ int mca_rcache_base_vma_tree_iterate (mca_rcache_base_vma_module_t *vma_module, { mca_rcache_base_vma_tree_iterate_helper_args_t args = {.callback_fn = callback_fn, .ctx = ctx}; uintptr_t bound = (uintptr_t) base + size; - int rc; return opal_interval_tree_traverse (&vma_module->tree, (uint64_t) (intptr_t) base, bound, partial_ok, mca_rcache_base_vma_tree_iterate_helper, &args); diff --git a/opal/util/fd.c b/opal/util/fd.c index 5dd2c54d5c..8bf6470b28 100644 --- a/opal/util/fd.c +++ b/opal/util/fd.c @@ -176,7 +176,7 @@ const char *opal_fd_get_peer_name(int fd) } #endif else { - ret = strdup("Unknown"); + strncpy(str, "Unknown", len); } return ret; diff --git a/oshmem/tools/oshmem_info/param.c b/oshmem/tools/oshmem_info/param.c index 3309de4c42..502c4f52ed 100644 --- a/oshmem/tools/oshmem_info/param.c +++ b/oshmem/tools/oshmem_info/param.c @@ -2,7 +2,7 @@ * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * - * Copyright (c) 2014-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. @@ -416,13 +416,8 @@ void oshmem_info_do_config(bool want_all) MPI_MAX_INFO_VAL); opal_info_out_int("MPI_MAX_PORT_NAME", "options:mpi-max-port-name", MPI_MAX_PORT_NAME); -#if OMPI_PROVIDE_MPI_FILE_INTERFACE opal_info_out_int("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string", MPI_MAX_DATAREP_STRING); -#else - opal_info_out("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string", - "IO interface not provided"); -#endif /* This block displays all the options with which the current * installation of oshmem was configured. */