diff mbox

gssd: ensure that preferred_realm is non-NULL before passing it to strcmp

Message ID 1410194154-25567-1-git-send-email-jlayton@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton Sept. 8, 2014, 4:35 p.m. UTC
It's possible for "preferred_realm" to be NULL, in which case we
don't want to pass it to strcmp. Other places that use this variable
test whether it's NULL first -- we need to do the same here.

This should fix the gssd crash reported here:

    https://bugzilla.redhat.com/show_bug.cgi?id=1108615

Reported-by: Brian J. Murrell <brian@interlinx.bc.ca>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
 utils/gssd/krb5_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve Dickson Sept. 16, 2014, 1:30 p.m. UTC | #1
On 09/08/2014 12:35 PM, Jeff Layton wrote:
> It's possible for "preferred_realm" to be NULL, in which case we
> don't want to pass it to strcmp. Other places that use this variable
> test whether it's NULL first -- we need to do the same here.
> 
> This should fix the gssd crash reported here:
> 
>     https://bugzilla.redhat.com/show_bug.cgi?id=1108615
> 
> Reported-by: Brian J. Murrell <brian@interlinx.bc.ca>
> Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Committed... 

steved.

> ---
>  utils/gssd/krb5_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index 8369fdf0ed27..f1ebc0d09731 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -876,7 +876,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
>  	i = 0;
>  	realm = realmnames[i];
>  
> -	if (strcmp (realm, preferred_realm) != 0) {
> +	if (preferred_realm && strcmp (realm, preferred_realm) != 0) {
>  		realm = preferred_realm;
>  		/* resetting the realmnames index */
>  		i = -1;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 8369fdf0ed27..f1ebc0d09731 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -876,7 +876,7 @@  find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
 	i = 0;
 	realm = realmnames[i];
 
-	if (strcmp (realm, preferred_realm) != 0) {
+	if (preferred_realm && strcmp (realm, preferred_realm) != 0) {
 		realm = preferred_realm;
 		/* resetting the realmnames index */
 		i = -1;