From d1a58fbfbf17c5cefcc34cdbdcf7f1dab186ea9b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 18 Oct 2017 17:53:59 +0200 Subject: [PATCH] ifcfg-rh: limit reading GATEWAY_PING_TIMEOUT to 600 seconds libnm-core limits the rande for GATEWAY_PING_TIMEOUT to 0 to 600. See commit e86f8354a7aa5f8ba95b319f54f70e3e8aa9dbb7, "device: restart ping process when it exits with an error". The reader must not pass value out of range to g_object_set(). Clamp and warn. --- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index c5dff6a527..fcc0d6313b 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -249,9 +249,13 @@ make_connection_setting (const char *file, gint64 tmp; tmp = _nm_utils_ascii_str_to_int64 (v, 10, 0, G_MAXINT32 - 1, -1); - if (tmp >= 0) + if (tmp >= 0) { + if (tmp > 600) { + tmp = 600; + PARSE_WARNING ("invalid GATEWAY_PING_TIMEOUT time"); + } g_object_set (s_con, NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, (guint) tmp, NULL); - else + } else PARSE_WARNING ("invalid GATEWAY_PING_TIMEOUT time"); }