From 0b894f98e8491eefaa1821dbb73e138940cfb8d5 Mon Sep 17 00:00:00 2001 From: Quentin Armitage Date: Tue, 9 Jul 2024 11:18:02 +0100 Subject: [PATCH] all: Properly handle an include file name ending with '\' Signed-off-by: Quentin Armitage --- lib/parser.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/parser.c b/lib/parser.c index e43fab117..f34059fd8 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -1648,9 +1648,10 @@ have_brace(const char *conf_file) return false; do { - if (*p == '\\') - p++; - else if (*p == '{') + if (*p == '\\') { // Skip a '\' and following character + if (!*++p) // Ensure '\' not last character + return false; + } else if (*p == '{') return true; } while (*++p);