NeoMutt  2025-09-05-43-g177ed6
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 "mutt.h"
11#include "protos.h"
12
13bool StartupComplete = true;
14
18static int log_disp_null(time_t stamp, const char *file, int line, const char *function,
19 enum LogLevel level, const char *format, ...)
20{
21 return 0;
22}
23
24int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
25{
27 struct ConfigSet *cs = cs_new(16);
28 NeoMutt = neomutt_new(cs);
29 init_config(cs);
30 char file[] = "/tmp/mutt-fuzz";
31 FILE *fp = fopen(file, "wb");
32 if (!fp)
33 return -1;
34
35 fwrite(data, 1, size, fp);
36 fclose(fp);
37 fp = fopen(file, "rb");
38 if (!fp)
39 return -1;
40
41 struct Email *e = email_new();
42 struct Envelope *env = mutt_rfc822_read_header(fp, e, 0, 0);
43 mutt_parse_part(fp, e->body);
44 email_free(&e);
45 mutt_env_free(&env);
46 fclose(fp);
48 cs_free(&cs);
49 return 0;
50}
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
bool StartupComplete
When the config has been read.
Definition address.c:13
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:1821
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
Definition parse.c:1204
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:24
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:18
int log_dispatcher_t MuttLogger
LogLevel
Names for the Logging Levels.
Definition logging2.h:39
Convenience wrapper for the library headers.
Many unsorted constants and some structs.
void init_config(struct ConfigSet *cs)
Initialise the config system.
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
Prototypes for many functions.
Container for lots of config items.
Definition set.h:248
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:43