diff options
Diffstat (limited to 'source3/libads/sasl.c')
-rw-r--r-- | source3/libads/sasl.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c index ee3a693f717..a04ac9dd691 100644 --- a/source3/libads/sasl.c +++ b/source3/libads/sasl.c @@ -653,7 +653,12 @@ static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads, } strlower_m(server); - strupper_m(server_realm); + if (!strupper_m(server_realm)) { + SAFE_FREE(server); + SAFE_FREE(server_realm); + return ADS_ERROR(LDAP_NO_MEMORY); + } + if (asprintf(&princ, "ldap/%s@%s", server, server_realm) == -1) { SAFE_FREE(server); SAFE_FREE(server_realm); @@ -679,7 +684,11 @@ static ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads, } strlower_m(server); - strupper_m(server_realm); + if (!strupper_m(server_realm)) { + SAFE_FREE(server); + SAFE_FREE(server_realm); + return ADS_ERROR(LDAP_NO_MEMORY); + } if (asprintf(&princ, "ldap/%s@%s", server, server_realm) == -1) { SAFE_FREE(server); SAFE_FREE(server_realm); |