From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] Missing error checking in cmirrord
Date: Mon, 21 Jun 2010 22:11:56 +0200 [thread overview]
Message-ID: <4C1FC78C.40702@redhat.com> (raw)
In-Reply-To: <1276895420.26585.1.camel@hydrogen.msp.redhat.com>
On 06/18/2010 11:10 PM, Jonathan Brassow wrote:
> There are missing error checks... it's possible for
> sprintf to fail.
>
> brassow
>
> Index: LVM2/daemons/cmirrord/functions.c
> ===================================================================
> --- LVM2.orig/daemons/cmirrord/functions.c
> +++ LVM2/daemons/cmirrord/functions.c
> @@ -1371,15 +1371,21 @@ static int clog_get_sync_count(struct dm
>
> static int core_status_info(struct log_c *lc __attribute((unused)), struct dm_ulog_request *rq)
> {
> + int r;
> char *data = (char *)rq->data;
>
> - rq->data_size = sprintf(data, "1 clustered-core");
rq->data_size = 0;
> + r = sprintf(data, "1 clustered-core");
> + if (r < 0)
> + return r;
> +
> + rq->data_size = r;
rq->data_size = r + 1;
sprintf does not count trailing \0 ... (and this is probably part of
the mysterious fails of cmirrord).
Milan
prev parent reply other threads:[~2010-06-21 20:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-18 21:10 [PATCH] Missing error checking in cmirrord Jonathan Brassow
2010-06-19 0:55 ` Alasdair G Kergon
2010-06-21 20:11 ` Milan Broz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C1FC78C.40702@redhat.com \
--to=mbroz@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.