| ... | ... |
@@ -186,7 +186,7 @@ cli_file_t cli_filetype2(fmap_t *map, const struct cl_engine *engine) |
| 186 | 186 |
|
| 187 | 187 |
decoded = (unsigned char *) cli_utf16toascii((char *) buff, bread); |
| 188 | 188 |
if(decoded) {
|
| 189 |
- sret = cli_ac_scanbuff(decoded, strlen((char *) decoded), NULL, NULL, NULL, engine->root[0], &mdata, 0, CL_TYPE_TEXT_ASCII, NULL, AC_SCAN_FT, NULL); |
|
| 189 |
+ sret = cli_ac_scanbuff(decoded, bread / 2, NULL, NULL, NULL, engine->root[0], &mdata, 0, CL_TYPE_TEXT_ASCII, NULL, AC_SCAN_FT, NULL); |
|
| 190 | 190 |
free(decoded); |
| 191 | 191 |
if(sret == CL_TYPE_HTML) |
| 192 | 192 |
ret = CL_TYPE_HTML_UTF16; |
| ... | ... |
@@ -1138,7 +1138,7 @@ static int cli_scanhtml_utf16(cli_ctx *ctx) |
| 1138 | 1138 |
at += bytes; |
| 1139 | 1139 |
decoded = cli_utf16toascii(buff, bytes); |
| 1140 | 1140 |
if(decoded) {
|
| 1141 |
- if(write(fd, decoded, strlen(decoded)) == -1) {
|
|
| 1141 |
+ if(write(fd, decoded, bytes / 2) == -1) {
|
|
| 1142 | 1142 |
cli_errmsg("cli_scanhtml_utf16: Can't write to file %s\n", tempname);
|
| 1143 | 1143 |
free(decoded); |
| 1144 | 1144 |
close(fd); |