From:             richard at bradders2000 dot co dot uk
Operating system: Windows Server 2003
PHP version:      4.3.3RC3
PHP Bug Type:     Mail related
Bug description:  SentText infinite loop

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 bug report at http://bugs.php.net/?id=25037&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25037&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25037&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25037&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25037&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25037&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25037&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25037&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25037&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25037&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25037&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25037&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25037&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25037&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25037&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25037&r=gnused

Reply via email to