Quoted-Printable text uses "=" to insert a line break wherever the original 
text, after encoding all the unprintable characters, extends beyond 76 
characters (see <http://en.wikipedia.org/wiki/Quoted-printable>).

Our DecodeQuotedPrintable function handles these just fine, *if* the trailing 
'=' really is followed by a line break.  But if you give it a string with a '=' 
at the end, *not* followed by a line break, then what you get back has a null 
(i.e. ChrB(0)) at the end.  For example, DecodeQuotedPrintable("abc=") returns 
a 4-byte string, where the last byte is a null.

Now, it's not actually valid for Quoted-Printable text to end in an equals sign 
like this -- but it IS a pretty easy situation to get into, for example if 
you're trying to decode just part of a very long message to produce a message 
summary or some such.  It's also an insidious result, since the null byte isn't 
visible in a normal string display, yet it will cause string comparisons to 
fail unexpectedly, could screw up protocols if you send the result over a 
socket, etc.

So I'm inclined to think that DecodeQuotedPrintable should be made to handle 
this case of a trailing '=' and just ignore it, rather than inserting a null 
(or, perhaps, the value of whatever happens to be in memory after the end of 
the string -- I'm not sure about that).  But what do y'all think?

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to