File curl-CVE-2018-0500.patch of Package curl.openSUSE_Leap_15.0_Update
@@ -, +, @@
---
lib/smtp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/lib/smtp.c
+++ a/lib/smtp.c
@@ -1561,17 +1561,18 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
/* Do we need to allocate a scratch buffer? */
if(!scratch || data->set.crlf) {
oldscratch = scratch;
- scratch = newscratch = malloc(2 * data->set.buffer_size);
+ scratch = newscratch = malloc(2 * UPLOAD_BUFSIZE);
if(!newscratch) {
failf(data, "Failed to alloc scratch buffer!");
return CURLE_OUT_OF_MEMORY;
}
}
+ DEBUGASSERT(UPLOAD_BUFSIZE >= nread);
/* Have we already sent part of the EOB? */
eob_sent = smtp->eob;
/* This loop can be improved by some kind of Boyer-Moore style of
--