From patchwork Mon Sep 8 16:35:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4863661 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E133C0338 for ; Mon, 8 Sep 2014 16:36:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 589AC200E6 for ; Mon, 8 Sep 2014 16:36:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE9FF20138 for ; Mon, 8 Sep 2014 16:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754186AbaIHQgB (ORCPT ); Mon, 8 Sep 2014 12:36:01 -0400 Received: from mail-qc0-f181.google.com ([209.85.216.181]:63173 "EHLO mail-qc0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753739AbaIHQgA (ORCPT ); Mon, 8 Sep 2014 12:36:00 -0400 Received: by mail-qc0-f181.google.com with SMTP id i17so16055271qcy.12 for ; Mon, 08 Sep 2014 09:35:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Ork8GY7L6Hzk1ODREUa6Gj6JWan2x2BYUUt7KehwVI4=; b=HfB9OCKymFTi2quvg8l18g/GKQXvXpbU0cd1UFqMrOsVzv0wE7hwenmS3Fowr/F6ym +U8GEim6njvG5ytHMJF2u9YzeOB4lTUDJCjTA1xtTh6mbDcUR738vsGD5md+pm8sG2hu fAr6/TsNcJM1p8stuMMAq6mppSWKI4m15CsotEd22kTflP0TUgDun3MbaP26+D3mluGI OGXv7XUluBiieMg6+/hNKyrTwBoB0F2rDQZMVcGnfxicHwq6Sk3+vbN0OrqVeTHdg0cY bI5ZYRtHlOlvX238c1fXXiItuRzMlkMIFWNCzE0gO59hM731Qm1aj3riivqQDB5AqFEi sywQ== X-Gm-Message-State: ALoCoQlKXOVDF0h6SMd69zSrc/V9N+s9A4Pjyuq5Nr9qT1dPJ7c5FmwLY95aZct4x/ONDuapFUvr X-Received: by 10.224.136.130 with SMTP id r2mr42679067qat.66.1410194159095; Mon, 08 Sep 2014 09:35:59 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id k10sm8097813qaj.7.2014.09.08.09.35.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Sep 2014 09:35:58 -0700 (PDT) From: Jeff Layton To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH] gssd: ensure that preferred_realm is non-NULL before passing it to strcmp Date: Mon, 8 Sep 2014 12:35:54 -0400 Message-Id: <1410194154-25567-1-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Jeff Layton --- 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;