... | ... |
@@ -492,6 +492,7 @@ int cli_scanmacho(int fd, cli_ctx *ctx, struct cli_exe_info *fileinfo) |
492 | 492 |
|
493 | 493 |
int cli_machoheader(int fd, struct cli_exe_info *fileinfo) |
494 | 494 |
{ |
495 |
+return CL_EFORMAT; /* FIXMEFMAP: avoids crashing on machoes for now */ |
|
495 | 496 |
return cli_scanmacho(fd, NULL, fileinfo); |
496 | 497 |
} |
497 | 498 |
|
... | ... |
@@ -1089,13 +1089,14 @@ static int cli_scanhtml_utf16(cli_ctx *ctx) |
1089 | 1089 |
cli_dbgmsg("cli_scanhtml_utf16: using tempfile %s\n", tempname); |
1090 | 1090 |
|
1091 | 1091 |
while(at < map->len) { |
1092 |
- bytes = map->len - at > map->pgsz * 16 ? map->pgsz * 16 : map->len - at; |
|
1092 |
+ bytes = MIN(map->len - at, map->pgsz * 16); |
|
1093 | 1093 |
if(!(buff = fmap_need_off_once(map, at, bytes))) { |
1094 | 1094 |
close(fd); |
1095 | 1095 |
cli_unlink(tempname); |
1096 | 1096 |
free(tempname); |
1097 | 1097 |
return CL_EREAD; |
1098 | 1098 |
} |
1099 |
+ at += bytes; |
|
1099 | 1100 |
decoded = cli_utf16toascii(buff, bytes); |
1100 | 1101 |
if(decoded) { |
1101 | 1102 |
if(write(fd, decoded, strlen(decoded)) == -1) { |