From patchwork Thu Jun 15 18:24:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 9789787 X-Patchwork-Delegate: sameo@linux.intel.com 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 EAF4C60325 for ; Thu, 15 Jun 2017 18:25:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E44E92848F for ; Thu, 15 Jun 2017 18:25:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D92812861D; Thu, 15 Jun 2017 18:25:28 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 784942848F for ; Thu, 15 Jun 2017 18:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753167AbdFOSZ1 (ORCPT ); Thu, 15 Jun 2017 14:25:27 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:38491 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbdFOSZY (ORCPT ); Thu, 15 Jun 2017 14:25:24 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 7111B209E0; Thu, 15 Jun 2017 14:25:18 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 15 Jun 2017 14:25:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=8Mf /TRNg2lcWDNt7D4edembtTgvwvBDhotbQ5jb5Uvs=; b=WjxzQ7xljbBQuDNOALn 3InAwu505fcRH8EbLdIPcB8+VbOlzRt+2uzLpXmLrYK+elwSd8Iv3520Xh5a66Qw qwzpcvaQrzDpca43h5L1DrBdZ+lWGVBZBsgIn/9PWOJCy2fhl7HXBSpkTor75Hpg CI2ZHTM4koaNSYXtFRHSDfgA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=8Mf/TRNg2lcWDNt7D4edembtTgvwvBDhotbQ5jb5U vs=; b=Ih0zN0wAQdsOOdbwpziYjALQBpdqViav/B4H2ZxMaWBLRh9SvByzpwgMH 1hUJG689VyUUEu444DfooPRM69R+dTGobYyzl64RRUtvQGN16sD7rQDE7LKl43/T TqKDFEBFt9c6aBTDPT72ibrUVdFNtIUD8VK09qpOXXHtQz235E0CWeTFpjI37Gn0 MJ6iIPIxA0iV8wtcW+GQ1iWc3UO9d/FTgpU8Jd8ifHEa8cjwVVDTdO9HkciMSe95 ax7wWEuMIkHMBOepyJ+iTu4urykFTMQfgR/6z/UhKBs+f+lUResHUMJOERuQgN4z P56ViwknjgkFuEdPQlrY1i4LuWxWQ== X-ME-Sender: X-Sasl-enc: cu4MOI8Ftw57D5mmzYeOfZb1iq2kolhSpAZ35Boh6pK9 1497551118 Received: from blue.animalcreek.com (ip68-2-81-12.ph.ph.cox.net [68.2.81.12]) by mail.messagingengine.com (Postfix) with ESMTPA id 28C597E96F; Thu, 15 Jun 2017 14:25:18 -0400 (EDT) Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id 74FC3A202D8; Thu, 15 Jun 2017 11:25:17 -0700 (MST) From: Mark Greer To: Samuel Ortiz Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Mark Greer Subject: [PATCH 02/23] ndef: Fix use of uninitialized variable in property_get_type() Date: Thu, 15 Jun 2017 11:24:55 -0700 Message-Id: <20170615182516.4508-3-mgreer@animalcreek.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170615182516.4508-1-mgreer@animalcreek.com> References: <20170615182516.4508-1-mgreer@animalcreek.com> Organization: Animal Creek Technologies, Inc. Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The 'type' variable in property_get_type() is never set when the record type is invalid. This means that the check for NULL doesn't work as it should and a bogus string can be appended. Fix this by adding a default case to the switch statement that checks the record type ensuring that 'type' is set to NULL when the record type is invalid. Signed-off-by: Mark Greer --- src/ndef.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ndef.c b/src/ndef.c index b90205b..99f3bc3 100644 --- a/src/ndef.c +++ b/src/ndef.c @@ -342,6 +342,7 @@ static gboolean property_get_type(const GDBusPropertyTable *property, case RECORD_TYPE_WKT_ERROR: case RECORD_TYPE_UNKNOWN: case RECORD_TYPE_ERROR: + default: type = NULL; break;