Commit bb41fdb5 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Stop checking for CRLF when start of buffer is reached.

parent 3410aa1a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -333,10 +333,11 @@ int SMIME_crlf_copy(BIO *in, BIO *out, int flags)
	if(flags & PKCS7_TEXT) BIO_printf(out, "Content-Type: text/plain\r\n\r\n");
	while ((len = BIO_gets(in, linebuf, MAX_SMLEN)) > 0) {
		eol = 0;
		while(iscrlf(linebuf[len - 1])) {
		while(len && iscrlf(linebuf[len - 1])) {
			len--;
			eol = 1;
		}
		if (len)
			BIO_write(out, linebuf, len);
		if(eol) BIO_write(out, "\r\n", 2);
	}
@@ -402,7 +403,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
		} else if(part) {
			/* Strip CR+LF from linebuf */
			next_eol = 0;
			while(iscrlf(linebuf[len - 1])) {
			while(len && iscrlf(linebuf[len - 1])) {
				next_eol = 1;
				len--;
			}
@@ -413,6 +414,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
			} else if (eol)
				BIO_write(bpart, "\r\n", 2);
			eol = next_eol;
			if (len)
				BIO_write(bpart, linebuf, len);
		}
	}