Check tny_stream_read return value for -1 (fix 1 for NB#126941)
authorJose Dapena Paz <jdapena@igalia.com>
Mon, 20 Jul 2009 08:43:59 +0000 (10:43 +0200)
committerJose Dapena Paz <jdapena@igalia.com>
Mon, 20 Jul 2009 10:20:19 +0000 (12:20 +0200)
* src/modest-formatter.c (extract_text): check return value for
  tny_stream_read. If -1, finish processing.

src/modest-formatter.c

index 8cdd091..9cd37b6 100644 (file)
@@ -106,6 +106,9 @@ extract_text (ModestFormatter *self, TnyMimePart *body)
                        break;
                n_read = tny_stream_read (input_stream, buffer, next_read);
 
+               if (G_UNLIKELY (n_read < 0))
+                       break;
+
                offset = buffer;
                while (offset < buffer + n_read) {