From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 29B98D806CB for ; Tue, 25 Jul 2023 16:08:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FgtU92h70UenzugvXXDnqsBHuPjsNvrzaLKqUgWyV+M=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690301314; v=1; b=LLBoMM8GQ9vSjAxCb9dFZF6Ke+vJYJDKuiubF8lR4jzOY2OW2zboNwG5+CTnn1rfRLJhjJnV 5Pj4nh2sQnZiaZ8z1SMx9Upg3/P4Tu3y9bcjvkLaE+SHKOUVhAITzuPDyoJnN4063Fe41tIKLN2 8xl3NDxMcixOE9/smw+JVz5k= X-Received: by 127.0.0.2 with SMTP id lj4JYY7687511xVMC30dUONN; Tue, 25 Jul 2023 09:08:34 -0700 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.24411.1690301311691072354 for ; Tue, 25 Jul 2023 09:08:34 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="434027281" X-IronPort-AV: E=Sophos;i="6.01,230,1684825200"; d="scan'208";a="434027281" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 09:08:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="761261981" X-IronPort-AV: E=Sophos;i="6.01,230,1684825200"; d="scan'208";a="761261981" X-Received: from njayapra-mobl.gar.corp.intel.com ([10.215.120.243]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 09:08:08 -0700 From: "Jayaprakash, N" To: devel@edk2.groups.io Cc: Jayaprakash N , Rebecca Cran , Michael D Kinney , Kloper Dimitry Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix uninitialized global variable Date: Tue, 25 Jul 2023 21:37:56 +0530 Message-Id: <20230725160756.1869-2-n.jayaprakash@intel.com> In-Reply-To: <20230725160756.1869-1-n.jayaprakash@intel.com> References: <20230725160756.1869-1-n.jayaprakash@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,n.jayaprakash@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IWcX9XXLuZvI5VFulCaQ6C9bx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=LLBoMM8G; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506 res_init() is called from different places in sockets library. It depends on global _res variable containing a state. The problem is that if __BIND_RES_TEXT macro is not defined, _res is not initialized. Depending on compiler and build optimization this can fill the variable with garbage that is later used by res_init(). Fix is trivial - explicitly initialize _res. Cc: Rebecca Cran Cc: Michael D Kinney Cc: Jayaprakash N Signed-off-by: Kloper Dimitry --- StdLib/BsdSocketLib/res_init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/StdLib/BsdSocketLib/res_init.c b/StdLib/BsdSocketLib/res_init.c index 613a76a..faf2b5e 100644 --- a/StdLib/BsdSocketLib/res_init.c +++ b/StdLib/BsdSocketLib/res_init.c @@ -121,9 +121,11 @@ static u_int32_t net_mask __P((struct in_addr)); */ struct __res_state _res -# if defined(__BIND_RES_TEXT) +#if defined(__BIND_RES_TEXT) = { RES_TIMEOUT, } /* Motorola, et al. */ -# endif +#endif + = {0} +#endif ; -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107252): https://edk2.groups.io/g/devel/message/107252 Mute This Topic: https://groups.io/mt/100353380/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-