Commit 271d678b authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

LDAPworldP22: problem with msgids greater than 32767 on 64bit architectures

parent ccc2797a
...@@ -155,6 +155,7 @@ ber_getnint( BerElement *ber, long *num, int len ) ...@@ -155,6 +155,7 @@ ber_getnint( BerElement *ber, long *num, int len )
{ {
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
...@@ -172,11 +173,12 @@ ber_getnint( BerElement *ber, long *num, int len ) ...@@ -172,11 +173,12 @@ ber_getnint( BerElement *ber, long *num, int len )
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 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment