• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

neomutt / neomutt / 24648356273

18 Apr 2026 01:24PM UTC coverage: 42.851% (+0.5%) from 42.375%
24648356273

push

github

flatcap
merge: fix security issues

Raised by evilrabbit on Mutt devel mailing list.

 * security: fix GSSAPI buffer underflow on short unwrapped tokens
 * security: reject percent-encoded NUL bytes in URL decoding
 * security: skip CN fallback when SAN dNSName entries exist (RFC6125)
 * security: cap POP3 UIDL responses to prevent OOM from malicious server

3 of 7 new or added lines in 2 files covered. (42.86%)

3465 existing lines in 53 files now uncovered.

12428 of 29003 relevant lines covered (42.85%)

5272.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pattern/functions.c
1
/**
2
 * @file
3
 * Pattern functions
4
 *
5
 * @authors
6
 * Copyright (C) 2022-2023 Richard Russon <rich@flatcap.org>
7
 *
8
 * @copyright
9
 * This program is free software: you can redistribute it and/or modify it under
10
 * the terms of the GNU General Public License as published by the Free Software
11
 * Foundation, either version 2 of the License, or (at your option) any later
12
 * version.
13
 *
14
 * This program is distributed in the hope that it will be useful, but WITHOUT
15
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17
 * details.
18
 *
19
 * You should have received a copy of the GNU General Public License along with
20
 * this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22

23
/**
24
 * @page pattern_functions Pattern functions
25
 *
26
 * Pattern functions
27
 */
28

29
#include "config.h"
30
#include <stdbool.h>
31
#include <stdio.h>
32
#include "mutt/lib.h"
33
#include "core/lib.h"
34
#include "gui/lib.h"
35
#include "functions.h"
36
#include "key/lib.h"
37
#include "menu/lib.h"
38
#include "pattern_data.h"
39

40
/**
41
 * op_generic_select_entry - Select the current entry - Implements ::pattern_function_t - @ingroup pattern_function_api
42
 */
43
static int op_generic_select_entry(struct PatternFunctionData *fdata,
×
44
                                   const struct KeyEvent *event)
45
{
46
  struct PatternData *pd = fdata->pd;
×
UNCOV
47
  const int index = menu_get_index(pd->menu);
×
48
  struct PatternEntry *entry = ARRAY_GET(&pd->entries, index);
×
49

UNCOV
50
  if (entry)
×
51
    buf_strcpy(pd->buf, entry->tag);
×
52

53
  pd->done = true;
×
UNCOV
54
  pd->selection = true;
×
UNCOV
55
  return FR_SUCCESS;
×
56
}
57

58
/**
59
 * op_quit - Quit this menu - Implements ::pattern_function_t - @ingroup pattern_function_api
60
 */
61
static int op_quit(struct PatternFunctionData *fdata, const struct KeyEvent *event)
×
62
{
63
  struct PatternData *pd = fdata->pd;
×
UNCOV
64
  pd->done = true;
×
UNCOV
65
  pd->selection = false;
×
UNCOV
66
  return FR_SUCCESS;
×
67
}
68

69
// -----------------------------------------------------------------------------
70

71
/**
72
 * PatternFunctions - All the NeoMutt functions that the Pattern supports
73
 */
74
static const struct PatternFunction PatternFunctions[] = {
75
  // clang-format off
76
  { OP_GENERIC_SELECT_ENTRY,   op_generic_select_entry },
77
  { OP_QUIT,                   op_quit },
78
  { OP_EXIT,                   op_quit },
79
  { 0, NULL },
80
  // clang-format on
81
};
82

83
/**
84
 * pattern_function_dispatcher - Perform a Pattern function - Implements ::function_dispatcher_t - @ingroup dispatcher_api
85
 */
86
int pattern_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
×
87
{
88
  // The Dispatcher may be called on any Window in the Dialog
UNCOV
89
  struct MuttWindow *dlg = dialog_find(win);
×
90
  if (!event || !dlg || !dlg->wdata)
×
91
    return FR_ERROR;
92

93
  const int op = event->op;
×
94
  struct Menu *menu = dlg->wdata;
UNCOV
95
  struct PatternData *pd = menu->mdata;
×
UNCOV
96
  if (!pd)
×
97
    return FR_ERROR;
98

UNCOV
99
  struct PatternFunctionData fdata = {
×
100
    .n = NeoMutt,
101
    .pd = pd,
102
  };
103

104
  int rc = FR_UNKNOWN;
UNCOV
105
  for (size_t i = 0; PatternFunctions[i].op != OP_NULL; i++)
×
106
  {
107
    const struct PatternFunction *fn = &PatternFunctions[i];
UNCOV
108
    if (fn->op == op)
×
109
    {
110
      rc = fn->function(&fdata, event);
×
111
      break;
×
112
    }
113
  }
114

UNCOV
115
  if (rc == FR_UNKNOWN) // Not our function
×
116
    return rc;
117

UNCOV
118
  const char *result = dispatcher_get_retval_name(rc);
×
UNCOV
119
  mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
×
120

UNCOV
121
  return rc;
×
122
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc