From patchwork Fri Sep 23 20:55:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Roberts, William C" X-Patchwork-Id: 9348871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B3506077A for ; Fri, 23 Sep 2016 20:56:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B93B2ADE5 for ; Fri, 23 Sep 2016 20:56:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6038A2ADE7; Fri, 23 Sep 2016 20:56:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (smtp.nsa.gov [8.44.101.9]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D871E2ADE5 for ; Fri, 23 Sep 2016 20:56:32 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,383,1470700800"; d="scan'208";a="19519602" IronPort-PHdr: =?us-ascii?q?9a23=3AyALrwxUuMcHluKwyAFvbWrm/v3rV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZhyOt8tkgFKBZ4jH8fUM07OQ6PG6HzRfqs/c6zgrS99lb1c9k8?= =?us-ascii?q?IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9?= =?us-ascii?q?HOnpAIma153xjLHovcWMKFwV33KUWvBbFF2OtwLft80b08NJC50a7V/3mEZOYP?= =?us-ascii?q?lc3mhyJFiezF7W78a0+4N/oWwL46pyv/NaVe3GW4hwDfkBVHV1e1wysdbmsRjF?= =?us-ascii?q?UBun+moXUmJQlAFBRQfC8lWyRZvqmjfrvep6ni+BNIv5Sq5wET647qFnTBLAkT?= =?us-ascii?q?oOLT0i/WrKkM1sneRQpxfyiQZ4xtvLYYWRNfN7OKibZ9QQSHBdRe5QUTBMBsW3?= =?us-ascii?q?aI5cXKI6Ie9Eotyl9BM1phykCFzpXbvi?= X-IPAS-Result: =?us-ascii?q?A2HCBADDleVX/wHyM5BdGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxABAQEBAR6BU6Y0lEEjh2tMAQEBAQEBAQECAQJbJ4IyBAMTBYIRAgQBAjcUI?= =?us-ascii?q?A4DCQEBFwghCAgDAS0VEQcHCwUYBIgqvTkBCgEBASOIO4ZmEQGFegWPK4pLj2g?= =?us-ascii?q?CiXuFbpBnVIUlUgGFM3iBJwEBAQ?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 23 Sep 2016 20:56:31 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8NKuVp1007882; Fri, 23 Sep 2016 16:56:31 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u8NKu5OC198642 for ; Fri, 23 Sep 2016 16:56:05 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8NKu3v7007774; Fri, 23 Sep 2016 16:56:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1A+BABFluVX/yNjr8ZdGgEBAQECAQEBAQgBAQEBgzsBAQEBAR6BU7ZshBOGHgKBZEwBAgEBAQEBAl6FCQIEeRAgMVcHEohLvT0BAQEBAQEEAQEBASOIO4xyBY8rikuPaAKPaZBnVIUlHjQBh1IBAQE X-IPAS-Result: A1A+BABFluVX/yNjr8ZdGgEBAQECAQEBAQgBAQEBgzsBAQEBAR6BU7ZshBOGHgKBZEwBAgEBAQEBAl6FCQIEeRAgMVcHEohLvT0BAQEBAQEEAQEBASOIO4xyBY8rikuPaAKPaZBnVIUlHjQBh1IBAQE X-IronPort-AV: E=Sophos;i="5.30,383,1470715200"; d="scan'208";a="5726257" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 23 Sep 2016 16:56:04 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AxdD5dxSQ0CKeZj2sghiVfHtUPtpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa64bRKN2/xhgRfzUJnB7Loc0qyN4vqmATNLuMva+Fk5M7V0Hycfjs?= =?us-ascii?q?sXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJP?= =?us-ascii?q?K/jvHcaK1oLshrr0o8KYOlgTzBOGIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu?= =?us-ascii?q?5NznlpL1/A1zz158O34YIxu38I46Fp34d6XK77Z6U1S6BDRHRjajhtpZ6jiR6W?= =?us-ascii?q?VgaL530BQk0KgxFIBE7D9xi8UZDv9mPhuvFVxDiRPcqwS6s9Hzul8eMjQgXpji?= =?us-ascii?q?sDOhYg7WjNidd9h79BoQ6w4Rd4xt36eoaQYeV/eqfcdNZcTixbWcxcTTBaKoK6?= =?us-ascii?q?c4YLSeEGOLUL57LhrkcD+EPtTTKnA/nin3oR3if7?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0EPBADDleVX/yNjr8ZdGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFgEBAQMBAQEJAQEBgxABAQEBAR6BU6Y0kDiEE4YeAoFkTAEBAQEBAQE?= =?us-ascii?q?BAgECWyeCMgQBFQEEghECBHkQIDFXBxKIS705AQEBAQEBBAEBAQEBIog7jHIFj?= =?us-ascii?q?yuKS49oAo9pkGdUhSUeNAGGEoFAAQEB?= X-IPAS-Result: =?us-ascii?q?A0EPBADDleVX/yNjr8ZdGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBgxABAQEBAR6BU6Y0kDiEE4YeAoFkTAEBAQEBAQEBAgECWyeCMgQBF?= =?us-ascii?q?QEEghECBHkQIDFXBxKIS705AQEBAQEBBAEBAQEBIog7jHIFjyuKS49oAo9pkGd?= =?us-ascii?q?UhSUeNAGGEoFAAQEB?= X-IronPort-AV: E=Sophos;i="5.30,383,1470700800"; d="scan'208";a="19519560" Received: from fmsmga002-icc.fm.intel.com ([198.175.99.35]) by emsm-gh1-uea11.nsa.gov with ESMTP; 23 Sep 2016 20:56:03 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga002-icc.fm.intel.com with ESMTP; 23 Sep 2016 13:56:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,383,1470726000"; d="scan'208"; a="1035363963" Received: from psethi-mobl11.amr.corp.intel.com (HELO wcrobert-MOBL1.amr.corp.intel.com) ([10.254.124.71]) by orsmga001.jf.intel.com with ESMTP; 23 Sep 2016 13:56:02 -0700 From: william.c.roberts@intel.com To: selinux@tycho.nsa.gov, sds@tycho.nsa.gov, brindle@quarksecurity.com Subject: [PATCH 3/3] libsepol: fix unitialized variable 'nread' on mac build Date: Fri, 23 Sep 2016 13:55:52 -0700 Message-Id: <1474664152-18727-4-git-send-email-william.c.roberts@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474664152-18727-1-git-send-email-william.c.roberts@intel.com> References: <1474664152-18727-1-git-send-email-william.c.roberts@intel.com> X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP From: William Roberts Fix this: genusers.c:63:14: warning: variable 'nread' is uninitialized when used here [-Wuninitialized] if (buffer[nread - 1] == '\n') ^~~~~ genusers.c:40:15: note: initialize the variable 'nread' to silence this warning ssize_t nread; ^ = 0 Signed-off-by: William Roberts --- libsepol/src/genusers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libsepol/src/genusers.c b/libsepol/src/genusers.c index 57a9a2e..5568210 100644 --- a/libsepol/src/genusers.c +++ b/libsepol/src/genusers.c @@ -53,6 +53,7 @@ static int load_users(struct policydb *policydb, const char *path) } while(fgets(buffer, 255, fp) != NULL) { + nread = strlen(buffer); #else size_t len = 0; __fsetlocking(fp, FSETLOCKING_BYCALLER);