mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
LDAPworldP22: problem with msgids greater than 32767 on 64bit architectures
This commit is contained in:
parent
ccc2797a77
commit
271d678b0e
@ -155,6 +155,7 @@ ber_getnint( BerElement *ber, long *num, int len )
|
||||
{
|
||||
int diff, sign, i;
|
||||
long netnum;
|
||||
char *p;
|
||||
|
||||
/*
|
||||
* The tag and length have already been stripped off. We should
|
||||
@ -173,10 +174,11 @@ ber_getnint( BerElement *ber, long *num, int len )
|
||||
return( -1 );
|
||||
|
||||
/* sign extend if necessary */
|
||||
sign = ((0x80 << ((len - 1) * 8)) & netnum);
|
||||
p = (char *) &netnum;
|
||||
sign = (0x80 & *(p+diff) );
|
||||
if ( sign && len < sizeof(long) ) {
|
||||
for ( i = sizeof(long) - 1; i > len - 1; i-- ) {
|
||||
netnum |= (0xffL << (i * 8));
|
||||
for ( i = 0; i < diff; i++ ) {
|
||||
*(p+i) = 0xff;
|
||||
}
|
||||
}
|
||||
*num = LBER_NTOHL( netnum );
|
||||
|
Loading…
Reference in New Issue
Block a user