NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
address.c
Go to the documentation of this file.
1#include "config.h"
2#include <stdbool.h>
3#include <stdint.h>
4#include <stdio.h>
5#include <time.h>
6#include "mutt/lib.h"
7#include "config/lib.h"
8#include "email/lib.h"
9#include "core/lib.h"
10#include "globals.h"
11#include "init.h"
12
16static int log_disp_null(time_t stamp, const char *file, int line, const char *function,
17 enum LogLevel level, const char *format, ...)
18{
19 return 0;
20}
21
22int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
23{
25 struct ConfigSet *cs = cs_new(16);
26 NeoMutt = neomutt_new(cs);
27 init_config(cs);
28 OptNoCurses = true;
29 char file[] = "/tmp/mutt-fuzz";
30 FILE *fp = fopen(file, "wb");
31 if (!fp)
32 return -1;
33
34 fwrite(data, 1, size, fp);
35 fclose(fp);
36 fp = fopen(file, "rb");
37 if (!fp)
38 return -1;
39
40 struct Email *e = email_new();
41 struct Envelope *env = mutt_rfc822_read_header(fp, e, 0, 0);
42 mutt_parse_part(fp, e->body);
43 email_free(&e);
44 mutt_env_free(&env);
45 fclose(fp);
47 cs_free(&cs);
48 return 0;
49}
Convenience wrapper for the config headers.
void cs_free(struct ConfigSet **ptr)
Free a Config Set.
Definition: set.c:141
struct ConfigSet * cs_new(size_t size)
Create a new Config Set.
Definition: set.c:127
Convenience wrapper for the core headers.
struct Email * email_new(void)
Create a new Email.
Definition: email.c:77
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:46
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition: parse.c:1822
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
Definition: parse.c:1205
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
Definition: envelope.c:126
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Definition: address.c:22
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: globals.c:69
static int log_disp_null(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Discard log lines - Implements log_dispatcher_t -.
Definition: address.c:16
Config/command parsing.
void init_config(struct ConfigSet *cs)
Initialise the config system.
Definition: mutt_config.c:1033
int(*) log_dispatcher_ MuttLogger)
LogLevel
Names for the Logging Levels.
Definition: logging2.h:38
Convenience wrapper for the library headers.
struct NeoMutt * neomutt_new(struct ConfigSet *cs)
Create the main NeoMutt object.
Definition: neomutt.c:50
void neomutt_free(struct NeoMutt **ptr)
Free a NeoMutt.
Definition: neomutt.c:86
Container for lots of config items.
Definition: set.h:252
The envelope/body of an email.
Definition: email.h:39
struct Body * body
List of MIME parts.
Definition: email.h:69
The header of an Email.
Definition: envelope.h:57
Container for Accounts, Notifications.
Definition: neomutt.h:42