git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@837 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/09/08 07:49:02... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Sep 8 00:46:53 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/filetypes.c: limit buffer for ASCII test |
|
4 |
+ |
|
1 | 5 |
Tue Sep 7 23:14:42 CEST 2004 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/filetypes.c: add rule for "PK00PK" Zip archives (thanks to |
... | ... |
@@ -148,7 +148,7 @@ static const struct cli_smagic_s cli_smagic[] = { |
148 | 148 |
|
149 | 149 |
cli_file_t cli_filetype(const char *buf, size_t buflen) |
150 | 150 |
{ |
151 |
- int i, ascii = 1; |
|
151 |
+ int i, ascii = 1, len; |
|
152 | 152 |
|
153 | 153 |
|
154 | 154 |
for(i = 0; cli_magic[i].magic; i++) { |
... | ... |
@@ -160,8 +160,9 @@ cli_file_t cli_filetype(const char *buf, size_t buflen) |
160 | 160 |
} |
161 | 161 |
} |
162 | 162 |
|
163 |
- for(i = 0; i < buflen; i++) |
|
164 |
- if(!iscntrl(buf[i]) && !isprint(buf[i])) { /* FIXME: do we need to handle intern. chars? */ |
|
163 |
+ buflen < 25 ? (len = buflen) : (len = 25); |
|
164 |
+ for(i = 0; i < len; i++) |
|
165 |
+ if(!iscntrl(buf[i]) && !isprint(buf[i])) { /* FIXME: handle international chars */ |
|
165 | 166 |
ascii = 0; |
166 | 167 |
break; |
167 | 168 |
} |