[pango] pango-utils: Fix non-escaped \r\n line endings in pango_read_line()



commit 6f0648043fe2a084db15a6cdded8402625676aef
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Feb 17 09:27:36 2017 +0000

    pango-utils: Fix non-escaped \r\n line endings in pango_read_line()
    
    The handling for \r or \r\n line endings in pango_read_line() was
    broken. It should have discarded the \r or \r\n, but was only doing this
    for \n or \n\r. The condition (c == EOF) could never have been reached.
    
    Coverity ID: 1391696
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778816

 pango/pango-utils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 9bdc6f1..313471f 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -338,11 +338,12 @@ pango_read_line (FILE *stream, GString *str)
              if (!comment)
                quoted = TRUE;
              break;
+           case '\r':
            case '\n':
              {
                int next_c = getc_unlocked (stream);
 
-               if (!(c == EOF ||
+               if (!(next_c == EOF ||
                      (c == '\r' && next_c == '\n') ||
                      (c == '\n' && next_c == '\r')))
                  ungetc (next_c, stream);


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