git://git.exim.org
/
users
/
jgh
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
120854c
)
Extra checks on inbound SMTP stream buffer refill
author
Jeremy Harris
<jgh146exb@wizmail.org>
Fri, 9 Mar 2018 16:34:08 +0000
(16:34 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 10 Mar 2018 18:05:37 +0000
(18:05 +0000)
src/src/lookups/ldap.c
patch
|
blob
|
history
src/src/receive.c
patch
|
blob
|
history
src/src/smtp_in.c
patch
|
blob
|
history
src/src/tls-gnu.c
patch
|
blob
|
history
src/src/tls-openssl.c
patch
|
blob
|
history
src/src/tls.c
patch
|
blob
|
history
diff --git
a/src/src/lookups/ldap.c
b/src/src/lookups/ldap.c
index c3b214e8402c47c3eb43ae58cfea190691b726cf..0c2c87fc3e0d73535b9a32504dde5073a87eb776 100644
(file)
--- a/
src/src/lookups/ldap.c
+++ b/
src/src/lookups/ldap.c
@@
-889,7
+889,7
@@
while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
if (data)
{
(void) string_from_gstring(data);
if (data)
{
(void) string_from_gstring(data);
-
store_reset(data->s + data->ptr + 1
);
+
gstring_reset_unused(data
);
}
/* Copy the last dn into eldap_dn */
}
/* Copy the last dn into eldap_dn */
diff --git
a/src/src/receive.c
b/src/src/receive.c
index b502a381cb8ab7e070ee102c692d06dcfab6f2e1..6a534dc87c887ce38bf6e9adc5b6750042802b16 100644
(file)
--- a/
src/src/receive.c
+++ b/
src/src/receive.c
@@
-1034,6
+1034,7
@@
for (;;)
unsigned len = MAX(chunking_data_left, thismessage_size_limit - message_size + 1);
uschar * buf = bdat_getbuf(&len);
unsigned len = MAX(chunking_data_left, thismessage_size_limit - message_size + 1);
uschar * buf = bdat_getbuf(&len);
+ if (!buf) return END_EOF;
message_size += len;
if (fout && fwrite(buf, len, 1, fout) != 1) return END_WERROR;
}
message_size += len;
if (fout && fwrite(buf, len, 1, fout) != 1) return END_WERROR;
}
diff --git
a/src/src/smtp_in.c
b/src/src/smtp_in.c
index 03dcad73e25cb27644dc7b378299127767f3e881..a0cc581c26c07387834baf3b8302833d977c9097 100644
(file)
--- a/
src/src/smtp_in.c
+++ b/
src/src/smtp_in.c
@@
-653,7
+653,7
@@
next_cmd:
}
receive_getc = bdat_getc;
}
receive_getc = bdat_getc;
- receive_getbuf = bdat_getbuf;
+ receive_getbuf = bdat_getbuf;
/* r~getbuf is never actually used */
receive_ungetc = bdat_ungetc;
#ifndef DISABLE_DKIM
dkim_collect_input = dkim_save;
receive_ungetc = bdat_ungetc;
#ifndef DISABLE_DKIM
dkim_collect_input = dkim_save;
@@
-684,7
+684,7
@@
bdat_flush_data(void)
while (chunking_data_left)
{
unsigned n = chunking_data_left;
while (chunking_data_left)
{
unsigned n = chunking_data_left;
-
(void) bdat_getbuf(&n)
;
+
if (!bdat_getbuf(&n)) break
;
}
receive_getc = lwr_receive_getc;
}
receive_getc = lwr_receive_getc;
diff --git
a/src/src/tls-gnu.c
b/src/src/tls-gnu.c
index 6de0f023ad771521f2b6419882b50360da172059..eed8c06dc9d01bbdabcb7cbbf8ed456fe651b110 100644
(file)
--- a/
src/src/tls-gnu.c
+++ b/
src/src/tls-gnu.c
@@
-156,8
+156,8
@@
typedef struct exim_gnutls_state {
uschar *xfer_buffer;
int xfer_buffer_lwm;
int xfer_buffer_hwm;
uschar *xfer_buffer;
int xfer_buffer_lwm;
int xfer_buffer_hwm;
- int xfer_eof;
-
int
xfer_error;
+ BOOL xfer_eof; /*XXX never gets set! */
+
BOOL
xfer_error;
} exim_gnutls_state_st;
static const exim_gnutls_state_st exim_gnutls_state_init = {
} exim_gnutls_state_st;
static const exim_gnutls_state_st exim_gnutls_state_init = {
@@
-198,8
+198,8
@@
static const exim_gnutls_state_st exim_gnutls_state_init = {
.xfer_buffer = NULL,
.xfer_buffer_lwm = 0,
.xfer_buffer_hwm = 0,
.xfer_buffer = NULL,
.xfer_buffer_lwm = 0,
.xfer_buffer_hwm = 0,
- .xfer_eof =
0
,
- .xfer_error =
0
,
+ .xfer_eof =
FALSE
,
+ .xfer_error =
FALSE
,
};
/* Not only do we have our own APIs which don't pass around state, assuming
};
/* Not only do we have our own APIs which don't pass around state, assuming
@@
-2505,7
+2505,7
@@
alarm(0);
if (sigalrm_seen)
{
DEBUG(D_tls) debug_printf("Got tls read timeout\n");
if (sigalrm_seen)
{
DEBUG(D_tls) debug_printf("Got tls read timeout\n");
- state->xfer_error =
1
;
+ state->xfer_error =
TRUE
;
return FALSE;
}
return FALSE;
}
@@
-2541,7
+2541,7
@@
else if (inbytes == 0)
else if (inbytes < 0)
{
record_io_error(state, (int) inbytes, US"recv", NULL);
else if (inbytes < 0)
{
record_io_error(state, (int) inbytes, US"recv", NULL);
- state->xfer_error =
1
;
+ state->xfer_error =
TRUE
;
return FALSE;
}
#ifndef DISABLE_DKIM
return FALSE;
}
#ifndef DISABLE_DKIM
diff --git
a/src/src/tls-openssl.c
b/src/src/tls-openssl.c
index 8e8f27686eabcdd1cb8ee33caf1b0e74bc8542df..3376dce3f4410d95f886d5683c00904beff97a0c 100644
(file)
--- a/
src/src/tls-openssl.c
+++ b/
src/src/tls-openssl.c
@@
-2103,7
+2103,7
@@
DEBUG(D_tls)
*/
if (!ssl_xfer_buffer) ssl_xfer_buffer = store_malloc(ssl_xfer_buffer_size);
ssl_xfer_buffer_lwm = ssl_xfer_buffer_hwm = 0;
*/
if (!ssl_xfer_buffer) ssl_xfer_buffer = store_malloc(ssl_xfer_buffer_size);
ssl_xfer_buffer_lwm = ssl_xfer_buffer_hwm = 0;
-ssl_xfer_eof = ssl_xfer_error =
0
;
+ssl_xfer_eof = ssl_xfer_error =
FALSE
;
receive_getc = tls_getc;
receive_getbuf = tls_getbuf;
receive_getc = tls_getc;
receive_getbuf = tls_getbuf;
@@
-2498,14
+2498,14
@@
else if (error == SSL_ERROR_SSL)
{
ERR_error_string(ERR_get_error(), ssl_errstring);
log_write(0, LOG_MAIN, "TLS error (SSL_read): %s", ssl_errstring);
{
ERR_error_string(ERR_get_error(), ssl_errstring);
log_write(0, LOG_MAIN, "TLS error (SSL_read): %s", ssl_errstring);
- ssl_xfer_error =
1
;
+ ssl_xfer_error =
TRUE
;
return FALSE;
}
else if (error != SSL_ERROR_NONE)
{
DEBUG(D_tls) debug_printf("Got SSL error %d\n", error);
return FALSE;
}
else if (error != SSL_ERROR_NONE)
{
DEBUG(D_tls) debug_printf("Got SSL error %d\n", error);
- ssl_xfer_error =
1
;
+ ssl_xfer_error =
TRUE
;
return FALSE;
}
return FALSE;
}
diff --git
a/src/src/tls.c
b/src/src/tls.c
index 121b3d962de71f5ae8c1453c0c77e1af82e0dc96..f816620659963e9ccfa831164e78f3ea0ae917d7 100644
(file)
--- a/
src/src/tls.c
+++ b/
src/src/tls.c
@@
-41,8
+41,8
@@
static const int ssl_xfer_buffer_size = 4096;
static uschar *ssl_xfer_buffer = NULL;
static int ssl_xfer_buffer_lwm = 0;
static int ssl_xfer_buffer_hwm = 0;
static uschar *ssl_xfer_buffer = NULL;
static int ssl_xfer_buffer_lwm = 0;
static int ssl_xfer_buffer_hwm = 0;
-static int ssl_xfer_eof =
0
;
-static
int ssl_xfer_error = 0
;
+static int ssl_xfer_eof =
FALSE
;
+static
BOOL ssl_xfer_error = FALSE
;
#endif
uschar *tls_channelbinding_b64 = NULL;
#endif
uschar *tls_channelbinding_b64 = NULL;
@@
-162,7
+162,7
@@
Returns: non-zero if the eof flag is set
int
tls_feof(void)
{
int
tls_feof(void)
{
-return ssl_xfer_eof;
+return
(int)
ssl_xfer_eof;
}
}
@@
-184,7
+184,7
@@
Returns: non-zero if the error flag is set
int
tls_ferror(void)
{
int
tls_ferror(void)
{
-return ssl_xfer_error;
+return
(int)
ssl_xfer_error;
}
}