[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:
> 	OldCh				: Char; {tap}
> 	OldCh := #0;{tap}
> 				end
> 				else begin {tap: "=\0" means line
> 					break; {tap}
> 		{tap: if there is no quoted-string-mapping then the first
char of the next msgline will be overwritten}
> 		OldCh := FCurrentData[DecodedIndex]; {tap}
> 	if (OldCh <> #0) then {tap}
> 		FCurrentData[DecodedIndex] := OldCh; {tap}
<     else
> 	else begin {tap}
> 		ProcessDecodedLine(#13, 1); {tap: add \r\n to other
> 		ProcessDecodedLine(#10, 1); {tap}
> 	end; {tap}
> 		ProcessDecodedLine(#13, 1); {tap: add \r\n to other
> 		ProcessDecodedLine(#10, 1); {tap}
<             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.
> 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;

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