From 6bf7908d05d15eb62e61435f76ddae1f78dcdb7b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 25 May 2021 14:23:10 +0200 Subject: [PATCH] libnm: abort huge read in nm_vpn_service_plugin_read_vpn_details() There is no need to accept such a huge read. Abort. --- src/libnm-client-impl/nm-vpn-service-plugin.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libnm-client-impl/nm-vpn-service-plugin.c b/src/libnm-client-impl/nm-vpn-service-plugin.c index 5480b6538f..63dbbbbefc 100644 --- a/src/libnm-client-impl/nm-vpn-service-plugin.c +++ b/src/libnm-client-impl/nm-vpn-service-plugin.c @@ -835,6 +835,10 @@ nm_vpn_service_plugin_read_vpn_details(int fd, GHashTable **out_data, GHashTable if (!eof && c != '\n') { g_string_append_c(line, c); + if (line->len > 512 * 1024) { + /* we are about to read a huge line. That is not right, abort. */ + break; + } continue; }