[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: sb_sasl_pkt_length



> -----Original Message-----
> From: Kurt D. Zeilenga [mailto:Kurt@OpenLDAP.org]

> At 11:11 PM 2002-06-11, Howard Chu wrote:
> >That's the last time I pay attention to comments in the code.
>
> The comment is actually correct.  See RFC 2222.
>
> The problem, I suspect, is that there are implementations
> which overrun the negotiated buffer size.  I suggest we
> kick out a warning when the negotiated buffer size is
> exceeded, and error out when the hard buffer size is
> exceeded.

Something like this?

diff -u -r1.56 cyrus.c
--- cyrus.c     2002/06/07 01:40:16     1.56
+++ cyrus.c     2002/06/12 09:28:57
@@ -161,12 +161,16 @@
                | buf[2] << 8
                | buf[3];

-       if ( size > max ) {
+       if ( size > SASL_MAX_BUFF_SIZE ) {
                /* somebody is trying to mess me up. */
                ber_log_printf( LDAP_DEBUG_ANY, debuglevel,
                        "sb_sasl_pkt_length: received illegal packet length
"
                        "of %lu bytes\n", (unsigned long)size );
                size = 16; /* this should lead to an error. */
+       } else if ( size > max ) {
+               ber_log_printf( LDAP_DEBUG_ANY, debuglevel,
+                       "sb_sasl_pkt_length: received packet length "
+                       "of %lu exceeds negotiated max of %lu bytes\n",
(unsigned long)size, (unsigned long)max );
        }

        return size + 4; /* include the size !!! */
> >  -- Howard Chu
> >  Chief Architect, Symas Corp.       Director, Highland Sun
> >  http://www.symas.com               http://highlandsun.com/hyc
> >  Symas: Premier OpenSource Development and Support