Skip to content

Commit c450b21

Browse files
committed
opal/util: fix opal_str_to_bool()
correctly use strlen(char *) instead of sizeof(char *) Thanks Georg Geiser for reporting this issue. Refs. #7772 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent d5c4f6b commit c450b21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

opal/util/info.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights
1616
* reserved.
17-
* Copyright (c) 2015-2017 Research Organization for Information Science
18-
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2015-2020 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2016-2018 IBM Corporation. All rights reserved.
2020
* Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
2121
* $COPYRIGHT$
@@ -359,13 +359,13 @@ opal_str_to_bool(char *str)
359359
char *ptr;
360360

361361
/* Trim whitespace */
362-
ptr = str + sizeof(str) - 1;
362+
ptr = str + strlen(str) - 1;
363363
while (ptr >= str && isspace(*ptr)) {
364364
*ptr = '\0';
365365
--ptr;
366366
}
367367
ptr = str;
368-
while (ptr < str + sizeof(str) - 1 && *ptr != '\0' &&
368+
while (ptr < str + strlen(str) - 1 && *ptr != '\0' &&
369369
isspace(*ptr)) {
370370
++ptr;
371371
}

0 commit comments

Comments
 (0)