* [Cluster-devel] [PATCH gfs2-utils] don't dereference NULL for a hostdata string with no "="
@ 2009-06-29 15:59 Jim Meyering
2009-07-02 9:19 ` Steven Whitehouse
0 siblings, 1 reply; 3+ messages in thread
From: Jim Meyering @ 2009-06-29 15:59 UTC (permalink / raw)
To: cluster-devel.redhat.com
I didn't try to trigger this failure, but it looks like it'd be easy to do.
Just use a "hostdata" option, but omit the "=".
From a4d5ba668ecdabc9cbeac7a8f6ce5d227edae6b7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 29 Jun 2009 17:58:16 +0200
Subject: [PATCH gfs2-utils] 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 57a432a..0e009bd 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -492,9 +492,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);
--
1.6.3.3.467.g98a79
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH gfs2-utils] don't dereference NULL for a hostdata string with no "="
2009-06-29 15:59 [Cluster-devel] [PATCH gfs2-utils] don't dereference NULL for a hostdata string with no "=" Jim Meyering
@ 2009-07-02 9:19 ` Steven Whitehouse
2009-07-02 11:01 ` Jim Meyering
0 siblings, 1 reply; 3+ messages in thread
From: Steven Whitehouse @ 2009-07-02 9:19 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Looks good to me,
Steve.
On Mon, 2009-06-29 at 17:59 +0200, Jim Meyering wrote:
> I didn't try to trigger this failure, but it looks like it'd be easy to do.
> Just use a "hostdata" option, but omit the "=".
>
>
> >From a4d5ba668ecdabc9cbeac7a8f6ce5d227edae6b7 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@redhat.com>
> Date: Mon, 29 Jun 2009 17:58:16 +0200
> Subject: [PATCH gfs2-utils] 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 57a432a..0e009bd 100644
> --- a/gfs2/mount/util.c
> +++ b/gfs2/mount/util.c
> @@ -492,9 +492,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);
> --
> 1.6.3.3.467.g98a79
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH gfs2-utils] don't dereference NULL for a hostdata string with no "="
2009-07-02 9:19 ` Steven Whitehouse
@ 2009-07-02 11:01 ` Jim Meyering
0 siblings, 0 replies; 3+ messages in thread
From: Jim Meyering @ 2009-07-02 11:01 UTC (permalink / raw)
To: cluster-devel.redhat.com
Steven Whitehouse wrote:
> Looks good to me,
Thanks. Pushed.
> On Mon, 2009-06-29 at 17:59 +0200, Jim Meyering wrote:
>> I didn't try to trigger this failure, but it looks like it'd be easy to do.
>> Just use a "hostdata" option, but omit the "=".
>>
>>
>> >From a4d5ba668ecdabc9cbeac7a8f6ce5d227edae6b7 Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering@redhat.com>
>> Date: Mon, 29 Jun 2009 17:58:16 +0200
>> Subject: [PATCH gfs2-utils] don't dereference NULL for a hostdata string with no "="
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-02 11:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-29 15:59 [Cluster-devel] [PATCH gfs2-utils] don't dereference NULL for a hostdata string with no "=" Jim Meyering
2009-07-02 9:19 ` Steven Whitehouse
2009-07-02 11:01 ` Jim Meyering
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox