From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 471 invoked by alias); 2 Jul 2009 11:01:53 -0000 Received: (qmail 352 invoked by alias); 2 Jul 2009 11:01:53 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: gfs2-utils: master - don't dereference NULL for a hostdata string with no "=" To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: gfs2-utils.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: bf290707a90710422feeef90124459fdc39e783f X-Git-Newrev: c1309888b4824577cc334f3fcdb2b9bbcbe4a84b From: Jim Meyering Message-Id: <20090702110121.41A94120363@lists.fedorahosted.org> Date: Thu, 02 Jul 2009 11:01:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00009.txt.bz2 Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=c1309888b4824577cc334f3fcdb2b9bbcbe4a84b Commit: c1309888b4824577cc334f3fcdb2b9bbcbe4a84b Parent: bf290707a90710422feeef90124459fdc39e783f Author: Jim Meyering AuthorDate: Mon Jun 29 17:58:16 2009 +0200 Committer: Jim Meyering CommitterDate: Thu Jul 2 12:52:56 2009 +0200 don't dereference NULL for a hostdata string with no "=" * gfs2/mount/util.c (lock_dlm_join): Instead, just ignore it. --- gfs2/mount/util.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c index 16f8985..cb1a860 100644 --- a/gfs2/mount/util.c +++ b/gfs2/mount/util.c @@ -503,9 +503,11 @@ int lock_dlm_join(struct mount_options *mo, struct gen_sb *sb) if (!mo->hostdata[0]) snprintf(mo->hostdata, PATH_MAX, "%s", ma.hostdata); else { - char *p = strstr(ma.hostdata, "=") + 1; - strcat(mo->hostdata, ":"); - strcat(mo->hostdata, p); + const char *p = strstr(ma.hostdata, "="); + if (p) { + strcat(mo->hostdata, ":"); + strcat(mo->hostdata, p + 1); + } } log_debug("lock_dlm_join: hostdata: \"%s\"", mo->hostdata);