From 1aaa2467b9eb8a02a0ffd02cb703d0b1b4d1bef1 Mon Sep 17 00:00:00 2001 From: liangxin1300 Date: Thu, 17 Sep 2020 10:54:03 +0800 Subject: [PATCH] totemconfig: improve linknumber checking Check whether linknumber larger than INTERFACE_MAX and display error if so. Signed-off-by: liangxin1300 Reviewed-by: Jan Friesse --- exec/totemconfig.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/exec/totemconfig.c b/exec/totemconfig.c index 40e2b773..5c428c46 100644 --- a/exec/totemconfig.c +++ b/exec/totemconfig.c @@ -1369,6 +1369,16 @@ static int put_nodelist_members_to_config(struct totem_config *totem_config, icm if (res != 3 || strcmp(tmp_key2, "_addr") != 0) { continue; } + if (linknumber >= INTERFACE_MAX) { + snprintf (error_string_response, sizeof(error_string_response), + "parse error in config: interface ring number %u is bigger than allowed maximum %u\n", + linknumber, INTERFACE_MAX - 1); + *error_string = error_string_response; + + icmap_iter_finalize(iter2); + icmap_iter_finalize(iter); + return (-1); + } if (icmap_get_string_r(map, iter_key2, &node_addr_str) != CS_OK) { continue;