Hi,

I found a bug in src/common/gethostinfo.c:form_addr_and_mask.
This routine builds netmasks from integer values. This works
only for the values 8, 16 and 24. All other values will give
you a netmask of 0.0.0.0. Very bad if used in lpd.perms

btw I could be a good idea to check return values of inet_pton.

Willi

P.S. I have not checked, if my patch works with IPv6.

--------------------------------------------------------------------------------
*** ./src/common/gethostinfo.c.ori      Wed Feb  7 14:46:51 2001
--- ./src/common/gethostinfo.c  Wed Feb  7 14:48:51 2001
***************
*** 492,498 ****
                *s++ = '/';
                t = 0;
                m = strtol( s, &t, 0 );
!               if( t == 0 || *t ){
                        result = inet_pton(family, s, mask );
                } else if( m >= 0 ){
                        memset( mask, 0, addrlen );
--- 492,498 ----
                *s++ = '/';
                t = 0;
                m = strtol( s, &t, 0 );
!               if( t == 0 || *t || (family == AF_INET && m == 32)){
                        result = inet_pton(family, s, mask );
                } else if( m >= 0 ){
                        memset( mask, 0, addrlen );
***************
*** 517,522 ****
--- 517,523 ----
                                SNPRINTF(t,6) "%d", (~((1<<(8-bitcount))-1))&0xFF);
                                t += strlen(t);
                                *t = 0;
+                               ++i;
                        }
                        for( ; i < addrlen; ++i ){
                                if( buffer[0] ) *t++ = '.';
--------------------------------------------------------------------------------

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to