forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.c
42 lines (41 loc) · 969 Bytes
/
address.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "config.h"
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "mutt/logging.h"
#include "config/set.h"
#include "email/body.h"
#include "email/email.h"
#include "email/envelope.h"
#include "email/mime.h"
#include "email/parse.h"
#include "core/neomutt.h"
#include "globals.h"
#include "init.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
MuttLogger = log_disp_null;
struct ConfigSet *cs = cs_new(16);
NeoMutt = neomutt_new(cs);
init_config(cs);
OptNoCurses = true;
char file[] = "/tmp/mutt-fuzz";
FILE *fp = fopen(file, "wb");
if (fp != NULL)
{
fwrite(data, 1, size, fp);
fclose(fp);
}
fp = fopen(file, "rb");
struct Email *e = email_new();
struct Envelope *env = mutt_rfc822_read_header(fp, e, 0, 0);
mutt_parse_part(fp, e->body);
email_free(&e);
mutt_env_free(&env);
fclose(fp);
neomutt_free(&NeoMutt);
cs_free(&cs);
return 0;
}