From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 15702386DC52 for ; Tue, 14 Jun 2022 03:00:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15702386DC52 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-115-MLwhwP5gNXKc7VqhVOOCZg-1; Mon, 13 Jun 2022 23:00:08 -0400 X-MC-Unique: MLwhwP5gNXKc7VqhVOOCZg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6B631C05139 for ; Tue, 14 Jun 2022 03:00:07 +0000 (UTC) Received: from greed.delorie.com (unknown [10.22.8.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2955C28119 for ; Tue, 14 Jun 2022 03:00:07 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 25E3072a4057443 for ; Mon, 13 Jun 2022 23:00:07 -0400 Date: Mon, 13 Jun 2022 23:00:07 -0400 Message-Id: From: DJ Delorie To: libc-stable@sourceware.org Subject: [COMMITTED 2.35] nss: add assert to DB_LOOKUP_FCT (BZ #28752) X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2022 03:00:11 -0000 It's interesting if we have a null action list, so an assert is worthwhile. Suggested-by: DJ Delorie Signed-off-by: Sam James Reviewed-by: DJ Delorie (cherry picked from commit 3fdf0a205b622e40fa7e3c4ed1e4ed4d5c6c5380) diff --git a/nss/XXX-lookup.c b/nss/XXX-lookup.c index db95937674..bfc57b8e64 100644 --- a/nss/XXX-lookup.c +++ b/nss/XXX-lookup.c @@ -15,6 +15,7 @@ License along with the GNU C Library; if not, see . */ +#include #include "nsswitch.h" /*******************************************************************\ @@ -54,6 +55,10 @@ DB_LOOKUP_FCT (nss_action_list *ni, const char *fct_name, const char *fct2_name, *ni = DATABASE_NAME_SYMBOL; + /* We want to know about it if we've somehow got a NULL action list; + in the past, we had bad state if seccomp interfered with setup. */ + assert(*ni != NULL); + return __nss_lookup (ni, fct_name, fct2_name, fctp); } libc_hidden_def (DB_LOOKUP_FCT)