From patchwork Tue Sep 27 04:40:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9351481 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 4ACAF6077A for ; Tue, 27 Sep 2016 04:40:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EA9E28F3F for ; Tue, 27 Sep 2016 04:40:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3364F28F4B; Tue, 27 Sep 2016 04:40:57 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A9E1628F3F for ; Tue, 27 Sep 2016 04:40:56 +0000 (UTC) Received: from localhost ([::1]:47977 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokCN-0001Ty-LX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Sep 2016 00:40:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokC0-0001SG-5l for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bokBw-00068n-2a for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:40:32 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:35595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokBv-00068U-Rf for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:40:28 -0400 Received: by mail-oi0-x241.google.com with SMTP id n202so165481oig.2 for ; Mon, 26 Sep 2016 21:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=rm1t1+vwJRzB6iBvo3I+i4v2N2la2cf1oJ6VyhP8CvY=; b=BC3+qQtnh+WSziX2AYPNBSrwLd5e0OgLiOhr7whAMOzdqcPXCLvCh6+6nV74DTHF4i JMFL/rZ0yfzISskQK5Gi1K6xzQ+Wj+gik+Doh+dh2PC1bh8179+zNGxYLcB1yb6oL1FZ gxv11y115/CVe7BMzP5SoXcvwWvowMmsAH4FOKXJsvldnkQsj5RH3q1zhVjN+f1/fuZU d63oiNw3Aoh2uDoHnay6W3Ge4wdemWjeZq8TBZnsSkA0jwIPvSG0rU66zYaGj/Hs67EB ZPHeScZ71j9G4Q6np1oJyWyY68na9rbJvZOErjj3Q4v6Ptcrcx3onzbNu/AgHkNJbnqs 4n9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=rm1t1+vwJRzB6iBvo3I+i4v2N2la2cf1oJ6VyhP8CvY=; b=MoCH429SaS20pGltPKPJpSCRRiznCubGtD8g4xwfUZPOVqhZgKlWwNzkUfUFpWizfw VXQoMYoK9rgPjcWtLFjquYjb75vKbp0JtZGx/K/Xz1hr5uNDxOg1tM0O20tlDULLjzl3 WO0cXpfjz+8z07Fj74fIw5XVaOpM9er4UHAawJGQHc2IBaMzOAWKjGcDZLfg8ITDl6Hg 2cCWEqrMfUrcc1BqWtZ2hUClTKzrcLrDLU8dgaKQIp/FmnXPcgZvBuUoFcIwWx++32+x f6HXJgkNKfHGuxY8WvHpOoLW8yPWlLtPhadMj0PxnEuuFgPqcqXL+AHdierW8n8Ys8E3 GkOg== X-Gm-Message-State: AE9vXwNf0vhCqm7Z5RdrTNMRsFqe/68Hjrb4O5UaKvRdQAGXz/5WqOaVQmIGRdP8IROmbA== X-Received: by 10.202.51.137 with SMTP id z131mr32950811oiz.184.1474951227162; Mon, 26 Sep 2016 21:40:27 -0700 (PDT) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id 95sm180226ots.1.2016.09.26.21.40.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Sep 2016 21:40:26 -0700 (PDT) Message-ID: <57e9f83a.e80d9d0a.89644.0d9f@mx.google.com> X-Google-Original-Message-ID: <1474951217-16004-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: aneesh.kumar@linux.vnet.ibm.com, groug@kaod.org, qemu-devel@nongnu.org Date: Mon, 26 Sep 2016 21:40:17 -0700 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::241 Subject: [Qemu-devel] [PATCH] 9pfs: make illegal path name detection more robust X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Li Qiang The parameter of name_is_illegal can be NULL, adding detection of this to avoid NULL pointer dereference issue. Signed-off-by: Li Qiang --- hw/9pfs/9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index dd3145c..d960a2e 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1277,7 +1277,7 @@ static int v9fs_walk_marshal(V9fsPDU *pdu, uint16_t nwnames, V9fsQID *qids) static bool name_is_illegal(const char *name) { - return !*name || strchr(name, '/') != NULL; + return !name || !*name || strchr(name, '/') != NULL; } static bool not_same_qid(const V9fsQID *qid1, const V9fsQID *qid2)