Diff for /libraries/liblber/decode.c between versions 1.1.3.1.6.1 and 1.1.4.1

version 1.1.3.1.6.1, 1998/08/17 19:47:34 version 1.1.4.1, 1998/08/08 23:05:23
Line 17 Line 17
 #include <stdarg.h>  #include <stdarg.h>
 #include "macos.h"  #include "macos.h"
 #else /* MACOS */  #else /* MACOS */
 #if defined(NeXT) || defined(VMS) || defined(__FreeBSD__)  #if defined(NeXT) || defined(VMS)
 #include <stdlib.h>  #include <stdlib.h>
 #else /* next || vms || freebsd */  #else /* next || vms */
   #ifndef __FreeBSD__
 #include <malloc.h>  #include <malloc.h>
 #endif /* next || vms || freebsd */  #endif
   #endif /* next || vms */
 #if defined(BC31) || defined(_WIN32)  #if defined(BC31) || defined(_WIN32)
 #include <stdarg.h>  #include <stdarg.h>
 #else /* BC31 || _WIN32 */  #else /* BC31 || _WIN32 */
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 173  ber_getnint( BerElement *ber, long *num, Line 174  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 */
         p = (char *) &netnum;          sign = ((0x80 << ((len - 1) * 8)) & netnum);
         sign = (0x80 & *(p+diff) );          if ( sign && len < sizeof(long) ) {
         if ( sign && len < sizeof(long) ) {                  for ( i = sizeof(long) - 1; i > len - 1; i-- ) {
                 for ( i = 0; i < diff; i++ ) {                          netnum |= (0xffL << (i * 8));
                         *(p+i) = 0xff;  
                 }                  }
         }          }
         *num = LBER_NTOHL( netnum );          *num = LBER_NTOHL( netnum );

Removed from v.1.1.3.1.6.1  
changed lines
  Added in v.1.1.4.1


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