#25037 [Opn->Asn]: SendText infinite loop

From: Date: Mon, 11 Aug 2003 13:58:20 +0000
Subject: #25037 [Opn->Asn]: SendText infinite loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45722@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: Open +Status: Assigned Bug Type: Mail related Operating System: Windows Server 2003 PHP Version: 4.3.3RC3 -Assigned To: +Assigned To: iliaa 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

« previous php.bugs (#45722) next »