[gtranslator] Check array boundaries in comments update



commit e8c31586581ba6a08ab38e8acb84c2cca0724353
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Wed Jan 5 10:16:17 2022 +0100

    Check array boundaries in comments update
    
    Fix https://gitlab.gnome.org/GNOME/gtranslator/-/issues/140

 src/gtr-header.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/gtr-header.c b/src/gtr-header.c
index d42ea5ee..3c350951 100644
--- a/src/gtr-header.c
+++ b/src/gtr-header.c
@@ -785,7 +785,14 @@ update_comments (GtrHeader *header, const gchar *comments)
 
           year_array = g_strsplit (comment_lines[i], ",", -1);
 
-          for (j = 1; year_array != NULL && year_array[j] != NULL; j++)
+          // Empty comment
+          if (year_array == NULL || year_array[0] == NULL)
+            {
+              g_strfreev (year_array);
+              continue;
+            }
+
+          for (j = 1; year_array[j] != NULL; j++)
             {
               gchar *search;
 


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