1
1

regx/base: fix an integer overflow

use strtol() instead of atoi() in order to handle hostnames
containing a large number.

This is a one-off commit for the release branches since
the regx framework has already been removed from master.

Refs. open-mpi/ompi#6729

Signed-off-by: perrynzhou <perrynzhou@gmail.com>
Этот коммит содержится в:
perrynzhou 2019-06-05 14:51:57 +09:00 коммит произвёл Gilles Gouaillardet
родитель 18f10377eb
Коммит 5acaf006ae

Просмотреть файл

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science * Copyright (c) 2018-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
@ -1056,7 +1056,7 @@ static int regex_parse_node_range(char *base, char *range, int num_digits, char
for (found = false, i = 0; i < len; ++i) { for (found = false, i = 0; i < len; ++i) {
if (isdigit((int) range[i])) { if (isdigit((int) range[i])) {
if (!found) { if (!found) {
start = atoi(range + i); start = strtol(range + i, NULL, 10);
found = true; found = true;
break; break;
} }