Ethereal-dev: [Ethereal-dev] patch: proto.c -- cleaned up processing return values for snprint

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ronald Henderson <Ronald.Henderson@xxxxxxxxxxxxxxxx>
Date: Tue, 31 Dec 2002 11:07:31 -0500
Folks:

The attached patch cleans up processing return values for most of the
snprintf and vsnprintf functions in "proto.c". Different C runtime libraries
may produce different results for these functions when the size limit is
exceeded. The char buffer may not be null terminated ('\0') as a result.
This patch now checks for this condition and forces a null termination
character to be added. Protocols I have been playing with (LDAP and SIP) can
have very large attribute/field values. If they exceed the ITEM_LABEL_LENGTH
size, it is possible on the windows platform that a blank line or extended
garbage data will appear for the protocol field value. This patch helps
resolve these issues.

Note: Other snprintf and vsnprintf functions return values need to be
clecked and cleanup in other ethereal modules.... 

---Ronald W. Henderson
 <<proto.c.patch>> 

Attachment: proto.c.patch
Description: Binary data