From patchwork Wed Apr 14 18:08:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 50174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 4393AB7D40 for ; Thu, 15 Apr 2010 04:10:02 +1000 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 01C82AD049; Wed, 14 Apr 2010 12:08:58 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.8 tests=AWL, BAYES_00, NO_MORE_FUNN, SPF_PASS autolearn=no version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.120]) by lists.samba.org (Postfix) with ESMTP id 81686AC552 for ; Wed, 14 Apr 2010 12:08:51 -0600 (MDT) X-Authority-Analysis: v=1.1 cv=WmptabtAmu+mu6Np0PIYOCJcrJXl+eoDYpk5yYlafsA= c=1 sm=0 a=hTvFcKyqTRUA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=hGzw-44bAAAA:8 a=w0XBXobxvEu-0Nhkxy0A:9 a=jPG1Z4Zce-se_E9fbwpCpqR-TCkA:4 a=dowx1zmaLagA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:44282] helo=mail.poochiereds.net) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id B9/2D-27200-1B406CB4; Wed, 14 Apr 2010 18:08:50 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 6D92B5807C; Wed, 14 Apr 2010 14:08:49 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Wed, 14 Apr 2010 14:08:48 -0400 Message-Id: <1271268529-462-1-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.6.6.1 Subject: [linux-cifs-client] [PATCH 1/2] mount.cifs: check for NULL pointer before calling strchr() X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org mount.cifs calls strchr on currentaddress, which may be a NULL pointer. Signed-off-by: Jeff Layton --- mount.cifs.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mount.cifs.c b/mount.cifs.c index acab8c8..f3aa464 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -1730,9 +1730,11 @@ mount_retry: case ECONNREFUSED: case EHOSTUNREACH: currentaddress = nextaddress; - nextaddress = strchr(currentaddress, ','); - if (nextaddress) - *nextaddress++ = '\0'; + if (currentaddress) { + nextaddress = strchr(currentaddress, ','); + if (nextaddress) + *nextaddress++ = '\0'; + } goto mount_retry; case ENODEV: fprintf(stderr,