Fixed problem with the content sniffing.
authorAlejandro G. Castro <alex@igalia.com>
Wed, 7 Oct 2009 18:55:23 +0000 (20:55 +0200)
committerAlejandro G. Castro <alex@igalia.com>
Wed, 7 Oct 2009 19:25:03 +0000 (21:25 +0200)
The content sniffing loop that checks the content patterns was not
controlling the length of each pattern.

https://bugzilla.gnome.org/show_bug.cgi?id=597545

libsoup/soup-content-sniffer.c

index ed57e7c..d55aab5 100644 (file)
@@ -279,7 +279,8 @@ sniff_unknown (SoupContentSniffer *sniffer, SoupMessage *msg,
                        int index_pattern = 0;
                        gboolean skip_row = FALSE;
 
-                       while (index_stream < resource_length) {
+                       while ((index_stream < resource_length) &&
+                              (index_pattern <= type_row->pattern_length)) {
                                /* Skip insignificant white space ("WS" in the spec) */
                                if (type_row->pattern[index_pattern] == ' ') {
                                        if (resource[index_stream] == '\x09' ||