Browse code

Add missing boundscheck to pdf code (bb #2226).

Török Edvin authored on 2010/09/20 20:51:23
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Sep 20 14:50:34 EEST 2010 (edwin)
2
+-------------------------------------
3
+ * libclamav/pdf.c: Add missing boundscheck to pdf code (bb #2226)
4
+
1 5
 Thu Sep 16 14:37:15 CEST 2010 (tk)
2 6
 ----------------------------------
3 7
  * clamconf: print information about 3rd party databases
... ...
@@ -119,6 +119,8 @@ static int find_stream_bounds(const char *start, off_t bytesleft, off_t byteslef
119 119
 	    q2++;
120 120
 	*stream = q2 - start;
121 121
 	bytesleft2 -= q2 - start;
122
+	if (bytesleft2 < 0)
123
+	    return 0;
122 124
 	q = q2;
123 125
 	q2 = cli_memstr(q, bytesleft2, "endstream", 9);
124 126
 	if (!q2)