From c450b2140540a1f8eae1a6e6f9a22d17cd40e7d8 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sat, 30 May 2020 11:26:26 +0900 Subject: [PATCH] opal/util: fix opal_str_to_bool() correctly use strlen(char *) instead of sizeof(char *) Thanks Georg Geiser for reporting this issue. Refs. open-mpi/ompi#7772 Signed-off-by: Gilles Gouaillardet --- opal/util/info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opal/util/info.c b/opal/util/info.c index f377217ec5..e77384ea98 100644 --- a/opal/util/info.c +++ b/opal/util/info.c @@ -14,8 +14,8 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ @@ -359,13 +359,13 @@ opal_str_to_bool(char *str) char *ptr; /* Trim whitespace */ - ptr = str + sizeof(str) - 1; + ptr = str + strlen(str) - 1; while (ptr >= str && isspace(*ptr)) { *ptr = '\0'; --ptr; } ptr = str; - while (ptr < str + sizeof(str) - 1 && *ptr != '\0' && + while (ptr < str + strlen(str) - 1 && *ptr != '\0' && isspace(*ptr)) { ++ptr; }