Fix bug 3039 more - Why read line by line?
authorColin Leroy <colin@colino.net>
Sun, 18 May 2014 18:42:04 +0000 (20:42 +0200)
committerColin Leroy <colin@colino.net>
Sun, 18 May 2014 18:42:46 +0000 (20:42 +0200)
src/html.c

index 874b595..db01262 100644 (file)
@@ -440,11 +440,13 @@ static SC_HTMLState sc_html_read_line(SC_HTMLParser *parser)
        gchar buf[SC_HTMLBUFSIZE];
        gchar buf2[SC_HTMLBUFSIZE];
        gint index;
+       gint n;
 
        if (parser->fp == NULL)
                return SC_HTML_EOF;
 
-       if (fgets(buf, sizeof(buf), parser->fp) == NULL) {
+       n = fread(buf, 1, sizeof(buf), parser->fp);
+       if (n == 0) {
                parser->state = SC_HTML_EOF;
                return SC_HTML_EOF;
        }