mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#4983: Partly revert tls_thread_self() paranoia from rev 1.154: Only
require that ldap_pvt_thread_t can be cast to u.long and is not wider. ITS#5010: In ldap_X509dn2bv(), catch error return from ber_decode_oid().
This commit is contained in:
parent
ed0c9d223a
commit
90fe4bd927
@ -406,16 +406,11 @@ static unsigned long tls_thread_self( void )
|
|||||||
* is an integral type that fits in an unsigned long
|
* is an integral type that fits in an unsigned long
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* force an error if ldap_pvt_thread_t is not such a type */
|
/* force an error if the ldap_pvt_thread_t type is too large */
|
||||||
enum {
|
enum { ok = sizeof( ldap_pvt_thread_t ) <= sizeof( unsigned long ) };
|
||||||
ok =
|
|
||||||
3 / (ldap_pvt_thread_t)2 == 1 /* integer */
|
|
||||||
&& (ldap_pvt_thread_t)-1 > 0UL /* not too wide signed */
|
|
||||||
&& (ldap_pvt_thread_t)-2 < -1UL /* not too wide unsigned */
|
|
||||||
};
|
|
||||||
typedef struct { int dummy: ok ? 1 : -1; } Check[ok ? 1 : -1];
|
typedef struct { int dummy: ok ? 1 : -1; } Check[ok ? 1 : -1];
|
||||||
|
|
||||||
return ldap_pvt_thread_self();
|
return (unsigned long) ldap_pvt_thread_self();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tls_init_threads( void )
|
static void tls_init_threads( void )
|
||||||
@ -3032,7 +3027,10 @@ ldap_X509dn2bv( void *x509_name, struct berval *bv, LDAPDN_rewrite_func *func,
|
|||||||
|
|
||||||
oid2.bv_val = oidptr;
|
oid2.bv_val = oidptr;
|
||||||
oid2.bv_len = oidrem;
|
oid2.bv_len = oidrem;
|
||||||
ber_decode_oid( &Oid, &oid2 );
|
if ( ber_decode_oid( &Oid, &oid2 ) < 0 ) {
|
||||||
|
rc = LDAP_DECODING_ERROR;
|
||||||
|
goto nomem;
|
||||||
|
}
|
||||||
oidname = find_oid( &oid2 );
|
oidname = find_oid( &oid2 );
|
||||||
if ( !oidname ) {
|
if ( !oidname ) {
|
||||||
newAVA->la_attr = oid2;
|
newAVA->la_attr = oid2;
|
||||||
|
Loading…
Reference in New Issue
Block a user