All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: Re: [patch] ocfs2: tighten up strlen() checking
Date: Mon, 12 Jul 2010 13:39:50 +0000	[thread overview]
Message-ID: <20100712132322.GA5658@bicker> (raw)
In-Reply-To: <20100712113006.GA2393@laptop.jp.oracle.com>

On Mon, Jul 12, 2010 at 07:30:06PM +0800, Wengang Wang wrote:
> Also, the uuid shouldn't be treated as NULL tailed string.
> 142 struct ocfs2_control_message_down {
> 143         char    tag[OCFS2_CONTROL_MESSAGE_OP_LEN];
> 144         char    space1;
> 145         char    uuid[OCFS2_TEXT_UUID_LEN];
> 146         char    space2;

The space1 and space2 characters are NULL terminators:

From ocfs2_control_do_down_msg():
        msg->space1 = msg->space2 = msg->newline = '\0';

I would have thought it had to be a "packed" struct, but it works
because there are only chars in that struct.  So that code is fine.

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [patch] ocfs2: tighten up strlen() checking
Date: Mon, 12 Jul 2010 15:39:50 +0200	[thread overview]
Message-ID: <20100712132322.GA5658@bicker> (raw)
In-Reply-To: <20100712113006.GA2393@laptop.jp.oracle.com>

On Mon, Jul 12, 2010 at 07:30:06PM +0800, Wengang Wang wrote:
> Also, the uuid shouldn't be treated as NULL tailed string.
> 142 struct ocfs2_control_message_down {
> 143         char    tag[OCFS2_CONTROL_MESSAGE_OP_LEN];
> 144         char    space1;
> 145         char    uuid[OCFS2_TEXT_UUID_LEN];
> 146         char    space2;

The space1 and space2 characters are NULL terminators:

From ocfs2_control_do_down_msg():
        msg->space1 = msg->space2 = msg->newline = '\0';

I would have thought it had to be a "packed" struct, but it works
because there are only chars in that struct.  So that code is fine.

regards,
dan carpenter

  reply	other threads:[~2010-07-12 13:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-10 14:33 [patch] ocfs2: tighten up strlen() checking Dan Carpenter
2010-07-10 14:33 ` [Ocfs2-devel] " Dan Carpenter
2010-07-12 11:30 ` Wengang Wang
2010-07-12 11:30   ` [Ocfs2-devel] " Wengang Wang
2010-07-12 13:39   ` Dan Carpenter [this message]
2010-07-12 13:39     ` Dan Carpenter
2010-07-12 14:31     ` Wengang Wang
2010-07-12 14:31       ` [Ocfs2-devel] " Wengang Wang
2010-07-12 16:49   ` Sunil Mushran
2010-07-12 16:49     ` [Ocfs2-devel] " Sunil Mushran
2010-07-12 16:46 ` Sunil Mushran
2010-07-12 16:46   ` [Ocfs2-devel] " Sunil Mushran
2010-07-12 18:33 ` Joel Becker
2010-07-12 18:33   ` [Ocfs2-devel] " Joel Becker

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=20100712132322.GA5658@bicker \
    --to=error27@gmail.com \
    --cc=ocfs2-devel@oss.oracle.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.