#25037 [Asn->Csd]: SendText infinite loop
| From: | iliaa@php.net | Date: | Mon, 11 Aug 2003 16:38:13 +0000 |
| Subject: | #25037 [Asn->Csd]: SendText infinite loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45736@lists.php.net to get a copy of this message | ||
ID: 25037
Updated by: iliaa@php.net
Reported By: richard at bradders2000 dot co dot uk
-Status: Assigned
+Status: Closed
Bug Type: Mail related
Operating System: Windows Server 2003
PHP Version: 4.3.3RC3
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-08-11 06:01:20] richard at bradders2000 dot co dot uk
Sorry, I had it as a 'SentText' issue... slight typo, should have been
'SendText'.
------------------------------------------------------------------------
[2003-08-11 05:25:03] richard at bradders2000 dot co dot uk
Description:
------------
When a message is > 1024 bytes in size and therefore broken down into
1024 chunks, there is a 'goto send_chunk;' being called an infinite
number of times because the conditional statement 'if ((parts * 1024) <
data_cln_len)' is always true if it is ever true. This basically causes
the function to just keep on sending data to the smtp server.
Problem wasnt there in RC1, just RC2 and RC3.
Reproduce code:
---------------
int parts = (int) floor(data_cln_len / 1024);
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) {
efree(data_cln);
return (res);
}
}
if ((parts * 1024) < data_cln_len) {
i = data_cln_len - (parts * 1024);
strlcpy(Buffer, p, i);
Buffer[i] = '\0';
goto send_chunk;
}
Expected result:
----------------
Data is sent in 1024 byte chunks. The remainder is then sent. Send is
then terminated with '\r\n.\r\n'
Actual result:
--------------
Data is sent in 1024 byte chunks. The remainder is then sent...again
and again and again and again. etc etc.
Send is never terminated.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25037&edit=1