summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-07-09 14:29:31 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2017-07-09 14:29:31 +0100
commitcd2e3fd052d5c6beceb412f6741b78622c759014 (patch)
tree8bf4e9e6a492a15ff0e88b361a5a04a953f88b3c /src
parentf1f7d0cddd4fb38d0bcf81be13d6e272789ff9c7 (diff)
Avoid creating before-buffer pointer. Bug 2145
Found by: ASAN / <ago@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/src/log.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/src/log.c b/src/src/log.c
index ddd71377e..62ee629b0 100644
--- a/src/src/log.c
+++ b/src/src/log.c
@@ -391,7 +391,7 @@ it gets statted to see if it has been cycled. With a datestamp, the datestamp
will be compared. The static slot for saving it is the same size as buffer,
and the text has been checked above to fit, so this use of strcpy() is OK. */
-if (type == lt_main)
+if (type == lt_main && string_datestamp_offset >= 0)
{
Ustrcpy(mainlog_name, buffer);
mainlog_datestamp = mainlog_name + string_datestamp_offset;
@@ -399,7 +399,7 @@ if (type == lt_main)
/* Ditto for the reject log */
-else if (type == lt_reject)
+else if (type == lt_reject && string_datestamp_offset >= 0)
{
Ustrcpy(rejectlog_name, buffer);
rejectlog_datestamp = rejectlog_name + string_datestamp_offset;
@@ -1000,7 +1000,7 @@ if ( flags & LOG_MAIN
operation. This happens at midnight, at which point we want to roll over
the file. Closing it has the desired effect. */
- if (mainlog_datestamp != NULL)
+ if (mainlog_datestamp)
{
uschar *nowstamp = tod_stamp(string_datestamp_type);
if (Ustrncmp (mainlog_datestamp, nowstamp, Ustrlen(nowstamp)) != 0)