16f69e768f
Resolves: rhbz#1800082 De-fuzzified fix-covscan-issues patch
150 lines
3.7 KiB
Diff
150 lines
3.7 KiB
Diff
diff --git a/include/sm/varargs.h b/include/sm/varargs.h
|
|
index 612858d..2609630 100644
|
|
--- a/include/sm/varargs.h
|
|
+++ b/include/sm/varargs.h
|
|
@@ -32,6 +32,11 @@
|
|
# define SM_VA_COPY(dst, src) __va_copy((dst), (src))
|
|
# else
|
|
# define SM_VA_COPY(dst, src) memcpy(&(dst), &(src), sizeof((dst)))
|
|
+# define SM_VA_END_COPY(ap) do { } while (0)
|
|
+# endif
|
|
+
|
|
+# ifndef SM_VA_END_COPY
|
|
+# define SM_VA_END_COPY(ap) va_end(ap)
|
|
# endif
|
|
|
|
/*
|
|
diff --git a/libsm/vfprintf.c b/libsm/vfprintf.c
|
|
index 87c353c..c99d4e5 100644
|
|
--- a/libsm/vfprintf.c
|
|
+++ b/libsm/vfprintf.c
|
|
@@ -782,6 +782,7 @@ number: if ((dprec = prec) >= 0)
|
|
done:
|
|
FLUSH();
|
|
error:
|
|
+ SM_VA_END_COPY(orgap);
|
|
if ((argtable != NULL) && (argtable != statargtable))
|
|
sm_free(argtable);
|
|
return sm_error(fp) ? SM_IO_EOF : ret;
|
|
diff --git a/sendmail/milter.c b/sendmail/milter.c
|
|
index 9b3667d..190bf9f 100644
|
|
--- a/sendmail/milter.c
|
|
+++ b/sendmail/milter.c
|
|
@@ -2441,8 +2441,7 @@ milter_negotiate(m, e, milters)
|
|
sm_syslog(LOG_ERR, e->e_id,
|
|
"Milter (%s): negotiate: returned %c instead of %c",
|
|
m->mf_name, rcmd, SMFIC_OPTNEG);
|
|
- if (response != NULL)
|
|
- sm_free(response); /* XXX */
|
|
+ SM_FREE(response);
|
|
milter_error(m, e);
|
|
return -1;
|
|
}
|
|
@@ -2457,8 +2456,7 @@ milter_negotiate(m, e, milters)
|
|
sm_syslog(LOG_ERR, e->e_id,
|
|
"Milter (%s): negotiate: did not return valid info",
|
|
m->mf_name);
|
|
- if (response != NULL)
|
|
- sm_free(response); /* XXX */
|
|
+ SM_FREE(response);
|
|
milter_error(m, e);
|
|
return -1;
|
|
}
|
|
@@ -2476,8 +2474,7 @@ milter_negotiate(m, e, milters)
|
|
sm_syslog(LOG_ERR, e->e_id,
|
|
"Milter (%s): negotiate: did not return enough info",
|
|
m->mf_name);
|
|
- if (response != NULL)
|
|
- sm_free(response); /* XXX */
|
|
+ SM_FREE(response);
|
|
milter_error(m, e);
|
|
return -1;
|
|
}
|
|
@@ -2593,11 +2590,11 @@ milter_negotiate(m, e, milters)
|
|
if (tTd(64, 5))
|
|
sm_dprintf("milter_negotiate(%s): received: version %u, fflags 0x%x, pflags 0x%x\n",
|
|
m->mf_name, m->mf_fvers, m->mf_fflags, m->mf_pflags);
|
|
+ SM_FREE(response);
|
|
return 0;
|
|
|
|
error:
|
|
- if (response != NULL)
|
|
- sm_free(response); /* XXX */
|
|
+ SM_FREE(response);
|
|
return -1;
|
|
}
|
|
|
|
@@ -3233,6 +3230,7 @@ milter_changeheader(m, response, rlen, e)
|
|
addheader(newstr(field), mh_value, H_USER, e,
|
|
!bitset(SMFIP_HDR_LEADSPC, m->mf_pflags));
|
|
}
|
|
+ SM_FREE(mh_value);
|
|
return;
|
|
}
|
|
|
|
@@ -3441,6 +3439,8 @@ milter_chgfrom(response, rlen, e)
|
|
{
|
|
if (tTd(64, 10))
|
|
sm_dprintf("didn't follow protocol argc=%d\n", argc);
|
|
+ if (argv != NULL)
|
|
+ free(argv);
|
|
return;
|
|
}
|
|
|
|
@@ -3459,6 +3459,7 @@ milter_chgfrom(response, rlen, e)
|
|
mail_esmtp_args);
|
|
}
|
|
Errors = olderrors;
|
|
+ free(argv);
|
|
return;
|
|
}
|
|
|
|
@@ -3506,6 +3507,8 @@ milter_addrcpt_par(response, rlen, e)
|
|
{
|
|
if (tTd(64, 10))
|
|
sm_dprintf("didn't follow protocol argc=%d\n", argc);
|
|
+ if (argv != NULL)
|
|
+ free(argv);
|
|
return;
|
|
}
|
|
olderrors = Errors;
|
|
@@ -3530,6 +3533,7 @@ milter_addrcpt_par(response, rlen, e)
|
|
}
|
|
|
|
Errors = olderrors;
|
|
+ free(argv);
|
|
return;
|
|
}
|
|
|
|
diff --git a/sendmail/queue.c b/sendmail/queue.c
|
|
index a323301..d61f626 100644
|
|
--- a/sendmail/queue.c
|
|
+++ b/sendmail/queue.c
|
|
@@ -8433,6 +8433,7 @@ split_by_recipient(e)
|
|
if (split_within_queue(ee) == SM_SPLIT_FAIL)
|
|
{
|
|
e->e_sibling = firstsibling;
|
|
+ SM_FREE(lsplits);
|
|
return false;
|
|
}
|
|
ee->e_flags |= EF_SPLIT;
|
|
@@ -8447,8 +8448,7 @@ split_by_recipient(e)
|
|
if (p == NULL)
|
|
{
|
|
/* let's try to get this done */
|
|
- sm_free(lsplits);
|
|
- lsplits = NULL;
|
|
+ SM_FREE(lsplits);
|
|
}
|
|
else
|
|
lsplits = p;
|
|
@@ -8470,7 +8470,7 @@ split_by_recipient(e)
|
|
{
|
|
sm_syslog(LOG_NOTICE, e->e_id, "split: count=%d, id%s=%s",
|
|
n - 1, n > 2 ? "s" : "", lsplits);
|
|
- sm_free(lsplits);
|
|
+ SM_FREE(lsplits);
|
|
}
|
|
split = split_within_queue(e) != SM_SPLIT_FAIL;
|
|
if (split)
|