Skip to content

Commit

Permalink
opal_var_dump_color_keys: fix an array overflow
Browse files Browse the repository at this point in the history
since opal_var_dump_color_keys is used with opal_argv_count()
and friends, make sure is is long enough and NULL terminated

Refs. open-mpi#11826

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
  • Loading branch information
ggouaillardet committed Jul 18, 2023
1 parent a8fbb4d commit 4b628f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions opal/runtime/opal_params_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* Copyright (c) 2010-2014 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014 Hochschule Esslingen. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2023 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
Expand Down Expand Up @@ -89,10 +89,11 @@ static bool opal_register_util_done = false;

static char *opal_var_dump_color_string = NULL;

static char *opal_var_dump_color_keys[OPAL_VAR_DUMP_COLOR_KEY_COUNT] = {
static char *opal_var_dump_color_keys[OPAL_VAR_DUMP_COLOR_KEY_COUNT+1] = {
[OPAL_VAR_DUMP_COLOR_VAR_NAME] = "name",
[OPAL_VAR_DUMP_COLOR_VAR_VALUE] = "value",
[OPAL_VAR_DUMP_COLOR_VALID_VALUES] = "valid_values"
[OPAL_VAR_DUMP_COLOR_VALID_VALUES] = "valid_values",
[OPAL_VAR_DUMP_COLOR_KEY_COUNT] = NULL
};

/**
Expand Down

0 comments on commit 4b628f3

Please sign in to comment.