All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] qdev-property: Make bit property parsing stricter
Date: Sat, 21 Jan 2012 18:07:46 +0100	[thread overview]
Message-ID: <4F1AF0E2.8050907@web.de> (raw)
In-Reply-To: <4F1AE974.2090401@suse.de>

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

On 2012-01-21 17:36, Andreas Färber wrote:
> Am 21.01.2012 14:43, schrieb Jan Kiszka:
>> By using strncasecmp, we allow for arbitrary characters after the
>> "on"/"off" string. Fix this by switching to strcasecmp.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> An alternative might be to increase the char count by one. For a const
> char* parameter I see the responsibility for nul-terminating at the
> caller though, so this seems right. Did you check all callers?

For any normal function that takes a char * string without a maximum
length, the responsibility for terminating is on caller side. Also
because we checks against patterns of different length. So we don't need
to jump through hoops here.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@web.de>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qdev-property: Make bit property parsing stricter
Date: Sat, 21 Jan 2012 18:07:46 +0100	[thread overview]
Message-ID: <4F1AF0E2.8050907@web.de> (raw)
In-Reply-To: <4F1AE974.2090401@suse.de>

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

On 2012-01-21 17:36, Andreas Färber wrote:
> Am 21.01.2012 14:43, schrieb Jan Kiszka:
>> By using strncasecmp, we allow for arbitrary characters after the
>> "on"/"off" string. Fix this by switching to strcasecmp.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> An alternative might be to increase the char count by one. For a const
> char* parameter I see the responsibility for nul-terminating at the
> caller though, so this seems right. Did you check all callers?

For any normal function that takes a char * string without a maximum
length, the responsibility for terminating is on caller side. Also
because we checks against patterns of different length. So we don't need
to jump through hoops here.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2012-01-21 17:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21 13:43 [Qemu-trivial] [PATCH] qdev-property: Make bit property parsing stricter Jan Kiszka
2012-01-21 13:43 ` [Qemu-devel] " Jan Kiszka
2012-01-21 16:36 ` [Qemu-trivial] " Andreas Färber
2012-01-21 16:36   ` Andreas Färber
2012-01-21 17:07   ` Jan Kiszka [this message]
2012-01-21 17:07     ` Jan Kiszka
2012-01-24 12:05     ` [Qemu-trivial] " Markus Armbruster
2012-01-24 12:05       ` Markus Armbruster
2012-01-27  5:50 ` [Qemu-trivial] " Stefan Hajnoczi
2012-01-27  5:50   ` [Qemu-devel] " Stefan Hajnoczi

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=4F1AF0E2.8050907@web.de \
    --to=jan.kiszka@web.de \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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.