[glib: 7/17] gkeyfile: Fix off-by-one error in calculating value length




commit b07408fe5dac31a1dd06785bbeb2fa50fd2cf3d6
Author: Philip Withnall <pwithnall endlessos org>
Date:   Sun Mar 14 15:39:38 2021 +0000

    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 <pwithnall endlessos org>

 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]