NeoMutt  2025-12-11-694-ga89709
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 "mutt/lib.h"
6#include "config/lib.h"
7#include "email/lib.h"
8#include "core/lib.h"
9#include "mutt.h"
10
11bool StartupComplete = true;
12
13// clang-format off
14extern const struct Module ModuleMain;
15extern const struct Module ModuleAddress; extern const struct Module ModuleAlias; extern const struct Module ModuleAttach; extern const struct Module ModuleAutocrypt;
16extern const struct Module ModuleBcache; extern const struct Module ModuleBrowser; extern const struct Module ModuleColor; extern const struct Module ModuleCommands;
17extern const struct Module ModuleComplete; extern const struct Module ModuleCompmbox; extern const struct Module ModuleCompose; extern const struct Module ModuleCompress;
18extern const struct Module ModuleConfig; extern const struct Module ModuleConn; extern const struct Module ModuleConvert; extern const struct Module ModuleCore;
19extern const struct Module ModuleEditor; extern const struct Module ModuleEmail; extern const struct Module ModuleEnvelope; extern const struct Module ModuleExpando;
20extern const struct Module ModuleGui; extern const struct Module ModuleHcache; extern const struct Module ModuleHelpbar; extern const struct Module ModuleHistory;
21extern const struct Module ModuleHooks; extern const struct Module ModuleImap; extern const struct Module ModuleIndex; extern const struct Module ModuleKey;
22extern const struct Module ModuleLua; extern const struct Module ModuleMaildir; extern const struct Module ModuleMbox; extern const struct Module ModuleMenu;
23extern const struct Module ModuleMh; extern const struct Module ModuleMutt; extern const struct Module ModuleNcrypt; extern const struct Module ModuleNntp;
24extern const struct Module ModuleNotmuch; extern const struct Module ModulePager; extern const struct Module ModuleParse; extern const struct Module ModulePattern;
25extern const struct Module ModulePop; extern const struct Module ModulePostpone; extern const struct Module ModuleProgress; extern const struct Module ModuleQuestion;
26extern const struct Module ModuleSend; extern const struct Module ModuleSidebar; extern const struct Module ModuleStore;
27// clang-format on
28
32static const struct Module *Modules[] = {
33 // clang-format off
34 &ModuleMain, &ModuleGui, // These two have priority
43// clang-format on
44#ifdef USE_AUTOCRYPT
46#endif
47#ifdef USE_HCACHE_COMPRESSION
49#endif
50#ifdef USE_HCACHE
52#endif
53#ifdef USE_LUA
54 &ModuleLua,
55#endif
56#ifdef USE_NOTMUCH
58#endif
59#ifdef USE_HCACHE
61#endif
62 NULL,
63};
64
65int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
66{
68
70 char **tmp_env = MUTT_MEM_CALLOC(2, char *);
71 neomutt_init(NeoMutt, tmp_env, Modules);
72 FREE(&tmp_env);
73
74 char file[] = "/tmp/mutt-fuzz";
75 FILE *fp = fopen(file, "wb");
76 if (!fp)
77 return -1;
78
79 fwrite(data, 1, size, fp);
80 fclose(fp);
81 fp = fopen(file, "rb");
82 if (!fp)
83 return -1;
84
85 struct Email *e = email_new();
86 struct Envelope *env = mutt_rfc822_read_header(fp, e, 0, 0);
87 mutt_parse_part(fp, e->body);
88 email_free(&e);
89 mutt_env_free(&env);
90 fclose(fp);
93 return 0;
94}
const struct Module ModuleAddress
Module for the Address library.
Definition module.c:90
const struct Module ModuleAlias
Module for the Alias library.
Definition module.c:108
const struct Module ModuleAttach
Module for the Attach library.
Definition module.c:108
const struct Module ModuleAutocrypt
Module for the Autocrypt library.
Definition module.c:79
const struct Module ModuleBcache
Module for the Bcache library.
Definition module.c:62
const struct Module ModuleBrowser
Module for the Browser library.
Definition module.c:73
const struct Module ModuleColor
Module for the Color library.
Definition module.c:62
const struct Module ModuleCommands
Module for the Commands library.
Definition module.c:72
const struct Module ModuleComplete
Module for the Complete library.
Definition module.c:62
const struct Module ModuleCompmbox
Module for the Compmbox library.
Definition module.c:72
const struct Module ModuleCompose
Module for the Compose library.
Definition module.c:73
const struct Module ModuleCompress
Module for the Compress library.
Definition module.c:62
Convenience wrapper for the config headers.
const struct Module ModuleConfig
Module for the Config library.
Definition module.c:99
bool StartupComplete
When the config has been read.
Definition address.c:11
const struct Module ModuleConn
Module for the Conn library.
Definition module.c:102
const struct Module ModuleConvert
Module for the Convert library.
Definition module.c:62
Convenience wrapper for the core headers.
const struct Module ModuleCore
Module for the Core library.
Definition module.c:63
const struct Module ModuleEditor
Module for the Editor library.
Definition module.c:62
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.
const struct Module ModuleEmail
Module for the Email library.
Definition module.c:132
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition parse.c:1833
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
Definition parse.c:1210
const struct Module ModuleEnvelope
Module for the Envelope library.
Definition module.c:62
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
Definition envelope.c:125
const struct Module ModuleExpando
Module for the Expando library.
Definition module.c:73
const struct Module ModulePop
Module for the Pop library.
Definition module.c:73
const struct Module ModuleParse
Module for the Parse library.
Definition module.c:62
const struct Module ModuleMaildir
Module for the Maildir library.
Definition module.c:80
const struct Module ModulePostpone
Module for the Postpone library.
Definition module.c:62
const struct Module ModuleSidebar
Module for the Sidebar library.
Definition module.c:83
const struct Module ModuleMh
Module for the Mh library.
Definition module.c:73
const struct Module ModuleLua
Module for the Lua library.
Definition module.c:72
const struct Module ModulePager
Module for the Pager library.
Definition module.c:73
const struct Module ModuleGui
Module for the Gui library.
Definition module.c:73
const struct Module ModuleProgress
Module for the Progress library.
Definition module.c:73
const struct Module ModuleMenu
Module for the Menu library.
Definition module.c:73
static const struct Module * Modules[]
All the library Modules.
Definition address.c:32
const struct Module ModuleNcrypt
Module for the Ncrypt library.
Definition module.c:92
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Definition address.c:65
const struct Module ModuleMutt
Module for the Mutt library.
Definition module.c:63
const struct Module ModuleHcache
Module for the Hcache library.
Definition module.c:82
const struct Module ModuleSend
Module for the Send library.
Definition module.c:87
const struct Module ModuleQuestion
Module for the Question library.
Definition module.c:62
const struct Module ModuleImap
Module for the Imap library.
Definition module.c:90
const struct Module ModuleMain
Module for the Main library.
Definition module.c:48
const struct Module ModuleStore
Module for the Store library.
Definition module.c:63
const struct Module ModuleMbox
Module for the Mbox library.
Definition module.c:73
const struct Module ModulePattern
Module for the Pattern library.
Definition module.c:73
const struct Module ModuleNntp
Module for the Nntp library.
Definition module.c:73
const struct Module ModuleHelpbar
Module for the Helpbar library.
Definition module.c:73
const struct Module ModuleHistory
Module for the History library.
Definition module.c:73
const struct Module ModuleNotmuch
Module for the Notmuch library.
Definition module.c:89
const struct Module ModuleKey
Module for the Key library.
Definition module.c:72
const struct Module ModuleIndex
Module for the Index library.
Definition module.c:87
const struct Module ModuleHooks
Module for the Hooks library.
Definition module.c:82
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 logging.c:515
int log_dispatcher_t MuttLogger
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
Convenience wrapper for the library headers.
Many unsorted constants and some structs.
void neomutt_cleanup(struct NeoMutt *n)
Clean up NeoMutt and Modules.
Definition neomutt.c:405
bool neomutt_init(struct NeoMutt *n, char **envp, const struct Module **modules)
Initialise NeoMutt.
Definition neomutt.c:319
struct NeoMutt * neomutt_new(void)
Create the main NeoMutt object.
Definition neomutt.c:307
void neomutt_free(struct NeoMutt **ptr)
Free a NeoMutt.
Definition neomutt.c:418
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:41