[twsocket] Re: BCB4 & MimeDec

Poessler Thomas Thomas.Poessler@uta.at
Mon, 19 Jun 2000 13:56:04 +0200


hello list !

I have found the bug in the ProcessLineQuotedPrintable routine.
The last statement of the 'if' overwrites the first char of the
next line.

So i added some code, and now it works. I also added some code
to support the 'Content-transfer-encoding: 7BIT'.

--------------------Here's the hole MimeDec.diff:
470a471
> 	OldCh				: Char; {tap}
473a475
> 	OldCh := #0;{tap}
502a505,507
> 				end
> 				else begin {tap: "=\0" means line
continuation}
> 					break; {tap}
505a511,512
> 		{tap: if there is no quoted-string-mapping then the first
char of the next msgline will be overwritten}
> 		OldCh := FCurrentData[DecodedIndex]; {tap}
509a517,519
> 	if (OldCh <> #0) then {tap}
> 		FCurrentData[DecodedIndex] := OldCh; {tap}
> 
823c833
<     else
---
> 	else begin {tap}
824a835,837
> 		ProcessDecodedLine(#13, 1); {tap: add \r\n to other
encodings}
> 		ProcessDecodedLine(#10, 1); {tap}
> 	end; {tap}
886a900,901
> 		ProcessDecodedLine(#13, 1); {tap: add \r\n to other
encodings}
> 		ProcessDecodedLine(#10, 1); {tap}
1212c1227
<             FBuffer[J] := #10;
---
> 			FBuffer[J] := #10;         {tap: ERROR ? #13}
--------------------

thanks to all...
	tap :-)

-----Original Message-----
From: roger.morton@dial.pipex.com [mailto:roger.morton@dial.pipex.com]
Sent: Friday, June 09, 2000 10:05 AM
To: twsocket@elists.org
Subject: [twsocket] Re: BCB4 & MimeDec


In <64F2D8873D87D21189560080C8945C1A01F20692@A-MAIL01>, Poessler Thomas
carefully scribed:
> 
> hello !
> 
> I had compiled the version 23.4.2000 and uses the component MimePas
> in a small utility.
> 
> now i noticed, on an email with a quoted-printable body i got only
> every second line.
> 
> 
<snip>
> 
> As i played with the Data-pointer in 'MimeDecoderPartLine' i noticed,
> the first char of the missing lines is an \0. And so i dont write
> the Data-pointer to the file.
> Data pointer to "\0NB+UNOB:2+XXXX+XXXX+000607:1532+00000000000054'\0"
> On the next call Data points to "DTM+137:20000607:102'\r\n\0"
> Note also the \r\n at the end of the line.
> 
> 


It's a bug at the beginning of the UUProcessLine routine:


    Result := TRUE;
    if FCurrentData^ = #0 then begin
        result := false;
        Exit;
    end;

It blows up when, as you say,  you pass decoded data with an initial binary
zero.  It's a long time since I tried to use MimeDec in earnest, but I think
I fixed this one just by passing a length parameter (which is available in
ProcessDecodedLine,  where UUProcessLine is called from) instead of relying
on the content of FCurrentData.

Roger Morton
roger.morton@dial.pipex.com