From patchwork Thu Sep 8 20:30:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Cashman X-Patchwork-Id: 9322031 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 9201260752 for ; Thu, 8 Sep 2016 20:34:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8112729971 for ; Thu, 8 Sep 2016 20:34:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 760EC299DC; Thu, 8 Sep 2016 20:34:26 +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=0.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (emsm-gh1-uea10.nsa.gov [8.44.101.8]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF5B29971 for ; Thu, 8 Sep 2016 20:34:25 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,302,1470700800"; d="scan'208";a="17391895" IronPort-PHdr: =?us-ascii?q?9a23=3A+q99yhLXzBHYE/wqgNmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgULfvxwZ3uMQTl6Ol3ixeRBMOAuqsC1bCd6vyxESxYuNDa4ShEKMQNHzY+yu?= =?us-ascii?q?wu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9?= =?us-ascii?q?GO35F8bogtit0KjqotuIMlwO2mD2OO8jZFXu9EOK55FQ2dMjYo8KiTLx6kNSfO?= =?us-ascii?q?pXwW46bXmypD3bovmKwZh47i5LsOgg/cMTGY/zfqA/UKAKRG9+azN92dfv/SXn?= =?us-ascii?q?YUPPoyJEEzZerh0dGAXB7RfnTr/toyD6sax7wyDcMsroHp4uXjH3w65tSRLswA?= =?us-ascii?q?wOLD48+Wef3sB7hblbpRunjxV5z5TTYY3TP/17KPCONegGTHZMC54CHxdKBZmx?= =?us-ascii?q?Os5WV+c=3D?= X-IPAS-Result: =?us-ascii?q?A2HtAwCzytFX/wHyM5BdGgEBAQECAQEBARcBAQQBAYMOAQE?= =?us-ascii?q?BAQEegVO6PCWHY0wBAQEBAQEBAQIBAlsngjIEAxMFBTkQVQINXwIBAwECDxUTB?= =?us-ascii?q?gEBDCALAQIDCQEBFwghCAgDAS0DAQUBCxEOCwUYBAGIKKNHgTI+MopWhS4BAQW?= =?us-ascii?q?HWAwdCBCEFYIBCohgEQFohRABji52ij6PQolPJYVnSI5CMYERVIJfDRuBbVCFR?= =?us-ascii?q?HiBJwEBAQ?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 08 Sep 2016 20:34:20 +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 u88KYJLp002139; Thu, 8 Sep 2016 16:34:19 -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 u88KVMvO096612 for ; Thu, 8 Sep 2016 16:31:22 -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 u88KVIH8001789 for ; Thu, 8 Sep 2016 16:31:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1BFAwDkydFXhjTcVdFdGwEBAQMBAQGDLQEBAQEBgXG2NoQShhwCgV5MAQIBAQEBAQITAQEBCAsLCRmFEQIBAxIVGQEBNwEPIDE0AQUBHBkiiCijRYEyPjKKVoUuAQEFh1gBAQEBBgIBHAgQhBWCAQqJWoF+C4MHji92ij6PQolPhgxIjkIxgRGDMw0RCoFtHDSHYwEBAQ X-IPAS-Result: A1BFAwDkydFXhjTcVdFdGwEBAQMBAQGDLQEBAQEBgXG2NoQShhwCgV5MAQIBAQEBAQITAQEBCAsLCRmFEQIBAxIVGQEBNwEPIDE0AQUBHBkiiCijRYEyPjKKVoUuAQEFh1gBAQEBBgIBHAgQhBWCAQqJWoF+C4MHji92ij6PQolPhgxIjkIxgRGDMw0RCoFtHDSHYwEBAQ X-IronPort-AV: E=Sophos;i="5.30,302,1470715200"; d="scan'208";a="5693983" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 08 Sep 2016 16:31:22 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3ATqKgPhXKdf0Rov5Vw5VPhjfVC1rV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZhKFt8tkgFKBZ4jH8fUM07OQ6PG5HzJaqs/d4ThCKMUKDE5dz5?= =?us-ascii?q?1O3kQJO42sMQXDNvnkbig3ToxpdWRO2DWFC3VTA9v0fFbIo3e/vnY4ExT7Mhdp?= =?us-ascii?q?dKyuQtaBx/q+2+36wZDPeQIA3GP7OuIrakvs5lyN54FW2dIkcfdpjEOR4zNhQK?= =?us-ascii?q?d//StQP1WdnhLxtI+b3aVI1GBugc8n7NNKSq7gfq41HvRyBTUiNH0ptoWw7UGQ?= =?us-ascii?q?BVjH2nxJSWgSkxxVEyDZ/Rr6WdH3qSK8ue1jiweAOsijYbkyWDmmp4xiUx/tgS?= =?us-ascii?q?FPYzIy+XrXj8V2pKtdrAimphA5yInRNtLGfMFid7/QKItJDVFKWdxcAnRM?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0E9AwBhydFXhjTcVdFdHAEBBAEBFwEBB?= =?us-ascii?q?AEBgw4BAQEBAYFxtjaEEoYcAoFeTAEBAQEBAQEBAgECEAEBAQgLCwkZL4IyGAw?= =?us-ascii?q?5EFUCDV8CAQMSFRkBATcBDyAxNAEFARwZIogoo0GBMj4yilaFLgEBBYdYAQEBA?= =?us-ascii?q?QYCARwIEIQVggEKiVqFEI4vdoo+j0KJT4YMSI5CMYERgzMNEQqBbRw0h2MBAQE?= X-IPAS-Result: =?us-ascii?q?A0E9AwBhydFXhjTcVdFdHAEBBAEBFwEBBAEBgw4BAQEBAYF?= =?us-ascii?q?xtjaEEoYcAoFeTAEBAQEBAQEBAgECEAEBAQgLCwkZL4IyGAw5EFUCDV8CAQMSF?= =?us-ascii?q?RkBATcBDyAxNAEFARwZIogoo0GBMj4yilaFLgEBBYdYAQEBAQYCARwIEIQVggE?= =?us-ascii?q?KiVqFEI4vdoo+j0KJT4YMSI5CMYERgzMNEQqBbRw0h2MBAQE?= X-IronPort-AV: E=Sophos;i="5.30,302,1470700800"; d="scan'208";a="17391680" Received: from mail-pa0-f52.google.com ([209.85.220.52]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 08 Sep 2016 20:31:20 +0000 Received: by mail-pa0-f52.google.com with SMTP id id6so20580101pad.3 for ; Thu, 08 Sep 2016 13:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20120917; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uUh931MMKebVl/H4gX9CvHfQmGSddWYXPzBRTE7oZnA=; b=HUHMaf9UQ0V4zd0YrOj/7aWN6/wQuRV5zkR41b58PPCxZW2DCTj7OXOMZ8LBK2PRZp 47sscziZc34uYXxgsRHtV4wwVSvwqkgOaiskj0HLGoWRMRTEJUHmXSrrVdVbmRz0nHvh PT7dJAzIa3GelMS3U4Lmy+fRQgsgWLLbOQf+BP7Cqc2DctBiJKa0ykjLs/kUFrrJdaRG OEqBBUGcgAeT45UREBZ9ysAUCfJeBdhYax659XXDNDNLWX5TPEl26Z7H4un2gaGx8MFD w4apOxeG/G0XGUz4iCk6vtHixVo2VZiP3I5J2G/4j9Wn47yYSFYBg5VMXqYzWg2hDkL8 OUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uUh931MMKebVl/H4gX9CvHfQmGSddWYXPzBRTE7oZnA=; b=lebHlEa/rDrJvR1XonNHYuj2bLPZpSP4aBKBm694vCi9H1/4/zbzfG8XfSO13GwdcZ GwJ5H8WMvbYqKSYnP3NCpDDYy/JvaCP2DQy87wy2mfzZbs+WIsRt+ekqGdquO2VAdDoZ Rf3jX3+KtkZOOMG2Gcid4mcGGzqbvo6M06MSb6udWwG6UNbTrCbPSRrVjqoF9CAaEKry jhTN7EXUfcnC8HUDGo98ueyCUiccKID582diJpoHrfyF6SfluTje0u60y7WEZywCfYL8 aeLKq79YPGKLfPQXz4S/404haomUUs6nd+0w75NmtG/b+ZW8FQJbjhT7fDQdZ7o2eXMd blpg== X-Gm-Message-State: AE9vXwMPZgDRJVwKtXXz+3L1LbhrOylZ6lcSeo9pgic4+eC2fWPRcGMN7mqu7ebvGzoAsQ== X-Received: by 10.66.0.226 with SMTP id 2mr2775043pah.35.1473366680095; Thu, 08 Sep 2016 13:31:20 -0700 (PDT) Received: from dcashman.mtv.corp.google.com ([172.22.115.19]) by smtp.gmail.com with ESMTPSA id 3sm42199731pai.48.2016.09.08.13.31.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Sep 2016 13:31:19 -0700 (PDT) From: Daniel Cashman To: selinux@tycho.nsa.gov Subject: [PATCH 4/5] libsepol: cil: Fix CIL_OP data assignment. Date: Thu, 8 Sep 2016 13:30:51 -0700 Message-Id: <1473366652-23929-5-git-send-email-dcashman@android.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1473366652-23929-4-git-send-email-dcashman@android.com> References: <1473366652-23929-1-git-send-email-dcashman@android.com> <1473366652-23929-2-git-send-email-dcashman@android.com> <1473366652-23929-3-git-send-email-dcashman@android.com> <1473366652-23929-4-git-send-email-dcashman@android.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: Cc: sds@tycho.nsa.gov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP From: dcashman cil_flavor enums stored in cil_list_items are not pointers, but rather the actual enum value. Remove pointer dereferences on this value to avoid segfaults. Signed-off-by: Daniel Cashman --- libsepol/cil/src/cil_policy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsepol/cil/src/cil_policy.c b/libsepol/cil/src/cil_policy.c index 78b135e..32b6b41 100644 --- a/libsepol/cil/src/cil_policy.c +++ b/libsepol/cil/src/cil_policy.c @@ -470,7 +470,7 @@ void cil_perms_to_policy(FILE **file_arr, uint32_t file_index, struct cil_list * fprintf(file_arr[file_index], " %s", ((struct cil_symtab_datum *)curr->data)->name); break; case CIL_OP: { - enum cil_flavor op_flavor = *((enum cil_flavor *)curr->data); + enum cil_flavor op_flavor = (enum cil_flavor)curr->data; char *op_str = NULL; switch (op_flavor) { @@ -673,7 +673,7 @@ static int cil_expr_to_string(struct cil_list *expr, char **out) case CIL_OP: { int len; char *expr_str; - enum cil_flavor op_flavor = *((enum cil_flavor *)curr->data); + enum cil_flavor op_flavor = (enum cil_flavor)curr->data; char *op_str = NULL; if (pos == 0) { @@ -742,7 +742,7 @@ static int cil_expr_to_string(struct cil_list *expr, char **out) break; } case CIL_CONS_OPERAND: { - enum cil_flavor operand_flavor = *((enum cil_flavor *)curr->data); + enum cil_flavor operand_flavor = (enum cil_flavor)curr->data; char *operand_str = NULL; switch (operand_flavor) { case CIL_CONS_U1: