From b07408fe5dac31a1dd06785bbeb2fa50fd2cf3d6 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 14 Mar 2021 15:39:38 +0000 Subject: [PATCH] gkeyfile: Fix off-by-one error in calculating value length This was harmless, as it was always +1 too long, so included the trailing nul terminator. However, upcoming changes will start to use it in a context where there is no nul terminator. Signed-off-by: Philip Withnall --- glib/gkeyfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index 229f38784..761a4141f 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -1396,7 +1396,7 @@ g_key_file_parse_key_value_pair (GKeyFile *key_file, while (g_ascii_isspace (*value_start)) value_start++; - value_len = line + length - value_start + 1; + value_len = line + length - value_start; value = g_strndup (value_start, value_len);