Diff for /libraries/liblber/decode.c between versions 1.1.3.1 and 1.3

version 1.1.3.1, 1998/08/08 22:43:15 version 1.3, 1998/08/09 02:13:59
Line 20 Line 20
 #if defined(NeXT) || defined(VMS)  #if defined(NeXT) || defined(VMS)
 #include <stdlib.h>  #include <stdlib.h>
 #else /* next || vms */  #else /* next || vms */
   #ifndef __FreeBSD__
 #include <malloc.h>  #include <malloc.h>
   #endif
 #endif /* next || vms */  #endif /* next || vms */
 #if defined(BC31) || defined(_WIN32)  #if defined(BC31) || defined(_WIN32)
 #include <stdarg.h>  #include <stdarg.h>
Line 155  ber_getnint( BerElement *ber, long *num, Line 157  ber_getnint( BerElement *ber, long *num,
 {  {
         int     diff, sign, i;          int     diff, sign, i;
         long    netnum;          long    netnum;
           char    *p;
   
         /*          /*
          * The tag and length have already been stripped off.  We should           * The tag and length have already been stripped off.  We should
Line 172  ber_getnint( BerElement *ber, long *num, Line 175  ber_getnint( BerElement *ber, long *num,
         if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )          if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )
                 return( -1 );                  return( -1 );
   
         /* sign extend if necessary */          /* sign extend if necessary */
         sign = ((0x80 << ((len - 1) * 8)) & netnum);          p = (char *) &netnum;
         if ( sign && len < sizeof(long) ) {          sign = (0x80 & *(p+diff) );
                 for ( i = sizeof(long) - 1; i > len - 1; i-- ) {          if ( sign && len < sizeof(long) ) {
                         netnum |= (0xffL << (i * 8));                  for ( i = 0; i < diff; i++ ) {
                           *(p+i) = 0xff;
                 }                  }
         }          }
         *num = LBER_NTOHL( netnum );          *num = LBER_NTOHL( netnum );

Removed from v.1.1.3.1  
changed lines
  Added in v.1.3


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org