]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/cyrus.c
Misc library fixes from HEAD
[openldap] / libraries / libldap / cyrus.c
index 6222090d231e3cc156cc36972955d74e50882eb4..ac963fc85e8de767974cc51656baf29931ef511e 100644 (file)
@@ -1023,7 +1023,7 @@ int ldap_pvt_sasl_secprops(
        sasl_security_properties_t *secprops )
 {
        int i, j, l;
-       char **props = ldap_str2charray( in, "," );
+       char **props;
        unsigned sflags = 0;
        int got_sflags = 0;
        sasl_ssf_t max_ssf = 0;
@@ -1033,7 +1033,11 @@ int ldap_pvt_sasl_secprops(
        unsigned maxbufsize = 0;
        int got_maxbufsize = 0;
 
-       if( props == NULL || secprops == NULL ) {
+       if( secprops == NULL ) {
+               return LDAP_PARAM_ERROR;
+       }
+       props = ldap_str2charray( in, "," );
+       if( props == NULL ) {
                return LDAP_PARAM_ERROR;
        }
 
@@ -1046,7 +1050,8 @@ int ldap_pvt_sasl_secprops(
                        if ( sprops[j].ival ) {
                                unsigned v;
                                char *next = NULL;
-                               if ( !isdigit( props[i][sprops[j].key.bv_len] )) continue;
+                               if ( !isdigit( (unsigned char)props[i][sprops[j].key.bv_len] ))
+                                       continue;
                                v = strtoul( &props[i][sprops[j].key.bv_len], &next, 10 );
                                if ( next == &props[i][sprops[j].key.bv_len] || next[0] != '\0' ) continue;
                                switch( sprops[j].ival ) {
@@ -1068,6 +1073,7 @@ int ldap_pvt_sasl_secprops(
                        break;
                }
                if ( BER_BVISNULL( &sprops[j].key )) {
+                       ldap_charray_free( props );
                        return LDAP_NOT_SUPPORTED;
                }
        }