mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-12 01:58:17 +00:00
always close file descriptor when opened, use standard types
This commit is contained in:
@ -211,13 +211,16 @@ 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, comp;
|
||||
int fd;
|
||||
u32 len = q->len, offset = 0, ascii = 0, utf8 = 0;
|
||||
ssize_t comp;
|
||||
|
||||
if (len >= MAX_FILE) len = MAX_FILE - 1;
|
||||
if ((fd = open(q->fname, O_RDONLY)) < 0) return 0;
|
||||
if ((comp = read(fd, buf, len)) != len) return 0;
|
||||
buf[len] = 0;
|
||||
comp = read(fd, buf, len);
|
||||
close(fd);
|
||||
if (comp != (ssize_t)len) return 0;
|
||||
buf[len] = 0;
|
||||
|
||||
while (offset < len) {
|
||||
|
||||
|
Reference in New Issue
Block a user