the p-clear(Matches) erased too much memory.
thanks valgrind
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
#define min(a,b) ((a<b)?a:b)
if (s[0] != 0) { /* avoid empty string as strstr argument */
#define min(a,b) ((a<b)?a:b)
if (s[0] != 0) { /* avoid empty string as strstr argument */
- p_clear(bestname, sizeof(bestname));
+ p_clear(bestname, countof(bestname));
while (a) {
if (a->name && strstr (a->name, s) == a->name) {
while (a) {
if (a->name && strstr (a->name, s) == a->name) {
int Num_matched = 0; /* Number of matches for completion */
char Completed[STRING] = { 0 }; /* completed string (command or variable) */
int Num_matched = 0; /* Number of matches for completion */
char Completed[STRING] = { 0 }; /* completed string (command or variable) */
-const char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */
+char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */
/* helper function for completion. Changes the dest buffer if
necessary/possible to aid completion.
/* helper function for completion. Changes the dest buffer if
necessary/possible to aid completion.
if (numtabs == 1) {
Num_matched = 0;
m_strcpy(User_typed, sizeof(User_typed), pt);
if (numtabs == 1) {
Num_matched = 0;
m_strcpy(User_typed, sizeof(User_typed), pt);
- p_clear(Matches, sizeof(Matches));
- p_clear(Completed, sizeof(Completed));
+ p_clear(Matches, countof(Matches));
+ p_clear(Completed, countof(Completed));
for (num = 0; Commands[num].name; num++)
candidate (Completed, User_typed, Commands[num].name,
sizeof(Completed));
for (num = 0; Commands[num].name; num++)
candidate (Completed, User_typed, Commands[num].name,
sizeof(Completed));
if (numtabs == 1) {
Num_matched = 0;
m_strcpy(User_typed, sizeof(User_typed), pt);
if (numtabs == 1) {
Num_matched = 0;
m_strcpy(User_typed, sizeof(User_typed), pt);
- p_clear(Matches, sizeof(Matches));
- p_clear(Completed, sizeof(Completed));
+ p_clear(Matches, countof(Matches));
+ p_clear(Completed, countof(Completed));
for (num = 0; MuttVars[num].option; num++)
candidate(Completed, User_typed, MuttVars[num].option,
sizeof(Completed));
for (num = 0; MuttVars[num].option; num++)
candidate(Completed, User_typed, MuttVars[num].option,
sizeof(Completed));
if (numtabs == 1) {
Num_matched = 0;
m_strcpy(User_typed, sizeof(User_typed), pt);
if (numtabs == 1) {
Num_matched = 0;
m_strcpy(User_typed, sizeof(User_typed), pt);
- p_clear(Matches, sizeof(Matches));
- p_clear(Completed, sizeof(Completed));
+ p_clear(Matches, countof(Matches));
+ p_clear(Completed, countof(Completed));
for (num = 0; menu[num].name; num++)
candidate (Completed, User_typed, menu[num].name, sizeof(Completed));
/* try the generic menu */
for (num = 0; menu[num].name; num++)
candidate (Completed, User_typed, menu[num].name, sizeof(Completed));
/* try the generic menu */
void pgp_void_passphrase (void)
{
void pgp_void_passphrase (void)
{
- p_clear(PgpPass, sizeof(PgpPass));
+ p_clear(PgpPass, countof(PgpPass));
void smime_void_passphrase (void)
{
void smime_void_passphrase (void)
{
- p_clear(SmimePass, sizeof(SmimePass));
+ p_clear(SmimePass, countof(SmimePass));
char buf[BUFSIZ];
unlink(s);
char buf[BUFSIZ];
unlink(s);
- p_clear(buf, sizeof(buf));
+ p_clear(buf, countof(buf));
while (sb.st_size > 0) {
fwrite(buf, 1, MIN(ssizeof(buf), sb.st_size), f);
sb.st_size -= MIN(ssizeof(buf), sb.st_size);
while (sb.st_size > 0) {
fwrite(buf, 1, MIN(ssizeof(buf), sb.st_size), f);
sb.st_size -= MIN(ssizeof(buf), sb.st_size);
SRAND (time (NULL));
umask (077);
SRAND (time (NULL));
umask (077);
- p_clear(Options, sizeof(Options));
- p_clear(QuadOptions, sizeof(QuadOptions));
+ p_clear(Options, countof(Options));
+ p_clear(QuadOptions, countof(QuadOptions));
#ifdef USE_NNTP
while ((i =
#ifdef USE_NNTP
while ((i =