fix ascii percentage calc

This commit is contained in:
van Hauser
2020-06-20 09:22:14 +02:00
parent 5ca303393f
commit 1381e96d8c

View File

@ -108,7 +108,7 @@ static u8 check_if_text(struct queue_entry *q) {
if (q->len < AFL_TXT_MIN_LEN) return 0;
u8 buf[MAX_FILE];
s32 fd, len = q->len, offset = 0, ascii = 0, utf8 = 0, type, comp;
s32 fd, len = q->len, offset = 0, ascii = 0, utf8 = 0, comp;
if ((fd = open(q->fname, O_RDONLY)) < 0) return 0;
if ((comp = read(fd, buf, len)) != len) return 0;
@ -198,7 +198,7 @@ static u8 check_if_text(struct queue_entry *q) {
if (percent_utf8 >= percent_ascii && percent_utf8 >= AFL_TXT_MIN_PERCENT)
return 2;
if (percent_utf8 >= AFL_TXT_MIN_PERCENT)
if (percent_ascii >= AFL_TXT_MIN_PERCENT)
return 1;
return 0;