[latexila] TemplatesPersonal: fix for loop condition with G_MAXINT



commit 9d2ff01cd398249958ce72e96c7ff852e1a6793b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Feb 8 09:03:49 2017 +0100

    TemplatesPersonal: fix for loop condition with G_MAXINT
    
    The condition was always true, even after overflow. What we want to
    avoid is negative numbers. So stop the loop at G_MAXINT.
    
    It is anyway extremely unlikely that someone has that many personal
    templates, so the bug never happened in practice.
    
    Found by Coverity.

 src/liblatexila/latexila-templates-personal.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/liblatexila/latexila-templates-personal.c b/src/liblatexila/latexila-templates-personal.c
index e17326f..eedce26 100644
--- a/src/liblatexila/latexila-templates-personal.c
+++ b/src/liblatexila/latexila-templates-personal.c
@@ -416,7 +416,7 @@ get_first_free_template_index (LatexilaTemplatesPersonal *templates)
 {
   gint template_num;
 
-  for (template_num = 0; template_num <= G_MAXINT; template_num++)
+  for (template_num = 0; template_num < G_MAXINT; template_num++)
     {
       if (!is_template_index_used (templates, template_num))
         return template_num;


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