git-svn: trunk@5037
Török Edvin authored on 2009/04/11 00:20:18... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Fri Apr 10 18:20:12 EEST 2009 (edwin) |
|
2 |
+------------------------------------- |
|
3 |
+ * libclamav/vba_extract.c: avoid size 1 reads for performance |
|
4 |
+ reasons (bb #1542). |
|
5 |
+ |
|
1 | 6 |
Fri Apr 10 16:23:00 EEST 2009 (edwin) |
2 | 7 |
------------------------------------- |
3 | 8 |
* libclamav/pe.c, libclamav/special.c, libclamav/special.h: Fix some |
... | ... |
@@ -1174,14 +1174,20 @@ cli_wm_decrypt_macro(int fd, off_t offset, uint32_t len, unsigned char key) |
1174 | 1174 |
static int |
1175 | 1175 |
skip_past_nul(int fd) |
1176 | 1176 |
{ |
1177 |
- char ch; |
|
1178 |
- |
|
1179 |
- do |
|
1180 |
- if(cli_readn(fd, &ch, 1) != 1) |
|
1181 |
- return FALSE; |
|
1182 |
- while(ch); |
|
1183 |
- |
|
1184 |
- return TRUE; |
|
1177 |
+ char *end; |
|
1178 |
+ char smallbuf[128]; |
|
1179 |
+ |
|
1180 |
+ do { |
|
1181 |
+ int nread = cli_readn(fd, smallbuf, sizeof(smallbuf)); |
|
1182 |
+ if (nread <= 0) |
|
1183 |
+ return FALSE; |
|
1184 |
+ end = memchr(smallbuf, '\0', nread); |
|
1185 |
+ if (end) { |
|
1186 |
+ if (lseek(fd, 1 + (end-smallbuf) - nread, SEEK_CUR) < 0) |
|
1187 |
+ return FALSE; |
|
1188 |
+ return TRUE; |
|
1189 |
+ } |
|
1190 |
+ } while (1); |
|
1185 | 1191 |
} |
1186 | 1192 |
|
1187 | 1193 |
/* |