summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-02-18 15:45:37 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-02-18 15:45:37 +0000
commitb249717db8ced250a586385f06e61cf7107d5222 (patch)
tree529e0e66c3de49de34f15f486a0d89b5cfac26ec
parent031117fe6ed880a56acf10a2181b6b0ca882fb1d (diff)
Specific check for null pointer
-rw-r--r--src/src/smtp_out.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c
index 608a781eb..fc1e6cecd 100644
--- a/src/src/smtp_out.c
+++ b/src/src/smtp_out.c
@@ -524,13 +524,21 @@ flush_buffer(smtp_outblock * outblock, int mode)
int rc;
int n = outblock->ptr - outblock->buffer;
BOOL more = mode == SCMD_MORE;
+client_conn_ctx * cctx;
HDEBUG(D_transport|D_acl) debug_printf_indent("cmd buf flush %d bytes%s\n", n,
more ? " (more expected)" : "");
+if (!(cctx = outblock->cctx))
+ {
+ log_write(0, LOG_MAIN|LOG_PANIC, "null conn-context pointer");
+ errno = 0;
+ return FALSE;
+ }
+
#ifndef DISABLE_TLS
-if (outblock->cctx->tls_ctx)
- rc = tls_write(outblock->cctx->tls_ctx, outblock->buffer, n, more);
+if (cctx->tls_ctx) /*XXX have seen a null cctx here, rvfy sending QUIT, hence check above */
+ rc = tls_write(cctx->tls_ctx, outblock->buffer, n, more);
else
#endif
@@ -544,7 +552,7 @@ else
requirement: TFO with data can, in rare cases, replay the data to the
receiver. */
- if ( (outblock->cctx->sock = smtp_connect(outblock->conn_args, &early_data))
+ if ( (cctx->sock = smtp_connect(outblock->conn_args, &early_data))
< 0)
return FALSE;
outblock->conn_args = NULL;
@@ -552,7 +560,7 @@ else
}
else
{
- rc = send(outblock->cctx->sock, outblock->buffer, n,
+ rc = send(cctx->sock, outblock->buffer, n,
#ifdef MSG_MORE
more ? MSG_MORE : 0
#else
@@ -567,7 +575,7 @@ else
https://bugzilla.redhat.com/show_bug.cgi?id=1803806 */
if (!more)
- setsockopt(outblock->cctx->sock, IPPROTO_TCP, TCP_CORK, &off, sizeof(off));
+ setsockopt(cctx->sock, IPPROTO_TCP, TCP_CORK, &off, sizeof(off));
#endif
}
}