cvs: php-src(PHP_4_3) / NEWS /win32 sendmail.c

From: Date: Mon, 08 Sep 2003 22:37:52 +0000
Subject: cvs: php-src(PHP_4_3) / NEWS /win32 sendmail.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-23703@lists.php.net to get a copy of this message
iliaa Mon Sep 8 18:37:52 2003 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/win32 sendmail.c Log: MFH: Fixed bug #25333 (Possible body corruption & crash in win32 mail()). Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.374 php-src/NEWS:1.1247.2.375 --- php-src/NEWS:1.1247.2.374 Sat Sep 6 19:57:40 2003 +++ php-src/NEWS Mon Sep 8 18:37:50 2003 @@ -12,6 +12,7 @@ - Fixed bug #25372 (sscanf() does not work with %X). (Jani) - Fixed bug #25348 ("make install" fails with --enable-short-tags). (Jani) - Fixed bug #25343 (is_dir() gives warning on FreeBSD). (Jani) +- Fixed bug #25333 (Possible body corruption & crash in win32 mail()). (Ilia) - Fixed bug #25308 (php -m crashes when zend extensions are loaded). (Stas) - Fixed bug #25307 (Crash with WDDX serializer). (Sascha, Jani) - Fixed bug #25239 (ftp_fopen_wrapper not RFC compliant). (Sara) Index: php-src/win32/sendmail.c diff -u php-src/win32/sendmail.c:1.47.2.7 php-src/win32/sendmail.c:1.47.2.8 --- php-src/win32/sendmail.c:1.47.2.7 Mon Aug 11 14:08:35 2003 +++ php-src/win32/sendmail.c Mon Sep 8 18:37:51 2003 @@ -17,7 +17,7 @@ * */ -/* $Id: sendmail.c,v 1.47.2.7 2003/08/11 18:08:35 iliaa Exp $ */ +/* $Id: sendmail.c,v 1.47.2.8 2003/09/08 22:37:51 iliaa Exp $ */ #include "php.h" /*php specific */ #include <stdio.h> @@ -362,7 +362,7 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data, char *headers, char *headers_lc, char **error_message) { - int res, i; + int res; char *p; char *tempMailTo, *token, *pos1, *pos2; char *server_response = NULL; @@ -596,35 +596,30 @@ * uses ZVAL as it's parameters */ data_cln = php_str_to_str(data, strlen(data), PHP_WIN32_MAIL_DOT_PATTERN, sizeof(PHP_WIN32_MAIL_DOT_PATTERN) - 1, PHP_WIN32_MAIL_DOT_REPLACE, sizeof(PHP_WIN32_MAIL_DOT_REPLACE) - 1, &data_cln_len); + if (!data_cln) { + data_cln = estrdup(""); + data_cln_len = 1; + } /* send message contents in 1024 chunks */ - if (data_cln_len <= 1024) { - if ((res = Post(data_cln)) != SUCCESS) { - efree(data_cln); - return (res); - } - } else { - int parts = (int) floor(data_cln_len / 1024); + { + char c, *e2, *e = data_cln + data_cln_len; p = data_cln; - for (i = 0; i < parts; i++) { - strlcpy(Buffer, p, 1024); - Buffer[1024] = '\0'; - p += 1024; -send_chunk: - /* send chunk */ - if ((res = Post(Buffer)) != SUCCESS) { + while (e - p > 1024) { + e2 = p + 1024; + c = *e2; + *e2 = '\0'; + if ((res = Post(p)) != SUCCESS) { efree(data_cln); - return (res); + return(res); } + *e2 = c; + p = e2; } - - if ((parts * 1024) < data_cln_len) { - i = data_cln_len - (parts * 1024); - strlcpy(Buffer, p, i); - Buffer[i] = '\0'; - parts++; - goto send_chunk; + if ((res = Post(p)) != SUCCESS) { + efree(data_cln); + return(res); } }

« previous php.cvs (#23703) next »