MSN protocol debugs cause crash!

Ethan Blanton elb at pidgin.im
Thu May 6 12:49:20 EDT 2010


Marty spake unto us the following wisdom:
> After much tracing around, I found that one of the debugs coming out
> from soap.c was longer than 64KiB.  It was one of the "current: ..."
> prints, where it shows the contents of what was received over the
> secure connection.  When this string is sent through a single printf
> (at least on my platform), absolutely AWEFUL and very random things
> happen.  I'm not sure if other C runtime libraries support such a
> large string in printf/vprintf, but mine certainly doesn't.

Looking at the C standard, I believe that it is legal for OS/2 to fail
to print this string, per the following sentence:

    The number of characters that can be produced by any single
    conversion shall be at least 4095.

There seem to be no other references to length or size in the relevant
portions of the stdio documentation, although my look was only
cursory.  However, I would argue that *crashing* is not an acceptable
failure mode; truncating the string in question would be an acceptable
failure mode.  In the absence of more compelling evidence, I view this
as an OS/2-specific operating system bug, and not something we should
really worry about in libpurple.  (The reason being that a legal
truncation of this string doesn't affect Pidgin's primary
functionality; were this in such functionality, I'd argue that we need
to truncate this to 4kB chunks.)  That said, I think we should accept
a patch which carefully splits the logged data into 4kB chunks,
*provided that* the large data in question is being passed through a
%s conversion.

Ethan

-- 
The laws that forbid the carrying of arms are laws [that have no remedy
for evils].  They disarm only those who are neither inclined nor
determined to commit crimes.
		-- Cesare Beccaria, "On Crimes and Punishments", 1764
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20100506/4b04af62/attachment.sig>


More information about the Devel mailing list