krb5_wrap: Do not return an empty realm from smb_krb5_get_realm_from_hostname()
authorAndreas Schneider <asn@samba.org>
Wed, 8 Mar 2017 09:40:08 +0000 (10:40 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 10 Mar 2017 10:37:21 +0000 (11:37 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12554

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/krb5_wrap/krb5_samba.c

index 8ebf601689b884626d37d45802577fcf518b3718..780a7a4adf5d553e482ef3bb8e045ce908fd09bb 100644 (file)
@@ -2715,7 +2715,9 @@ static char *smb_krb5_get_realm_from_hostname(TALLOC_CTX *mem_ctx,
                goto out;
        }
 
-       if (realm_list && realm_list[0]) {
+       if (realm_list != NULL &&
+           realm_list[0] != NULL &&
+           realm_list[0][0] != '\0') {
                realm = talloc_strdup(mem_ctx, realm_list[0]);
        }