From: Dan Carpenter <dan.carpenter@oracle.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: make sure strings are null terminated
Date: Wed, 23 Nov 2011 07:16:20 +0000 [thread overview]
Message-ID: <20111123071619.GB3363@mwanda> (raw)
In-Reply-To: <1322031811.1298.38.camel@edumazet-laptop>
[-- Attachment #1: Type: text/plain, Size: 594 bytes --]
On Wed, Nov 23, 2011 at 08:03:31AM +0100, Eric Dumazet wrote:
> > + if (strlen(dioctl.cf_ctrl.msn) >= sizeof(dioctl.cf_ctrl.msn))
> > + return -EINVAL;
>
> This looks buggy.
>
> If string is not null terminated, how strlen() will stop you from going
> out of bounds, and trigger some run time checker ?
>
> strnlen() would be more effective...
>
Aw crap. My first version used strnlen() and I redid it to be
simpler. I just figured that it doesn't take long to hit a zeroed
u8.
I'll resend all three strlen() patches to use strnlen().
regards,
dan carpenter
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: make sure strings are null terminated
Date: Wed, 23 Nov 2011 10:16:20 +0300 [thread overview]
Message-ID: <20111123071619.GB3363@mwanda> (raw)
In-Reply-To: <1322031811.1298.38.camel@edumazet-laptop>
[-- Attachment #1: Type: text/plain, Size: 594 bytes --]
On Wed, Nov 23, 2011 at 08:03:31AM +0100, Eric Dumazet wrote:
> > + if (strlen(dioctl.cf_ctrl.msn) >= sizeof(dioctl.cf_ctrl.msn))
> > + return -EINVAL;
>
> This looks buggy.
>
> If string is not null terminated, how strlen() will stop you from going
> out of bounds, and trigger some run time checker ?
>
> strnlen() would be more effective...
>
Aw crap. My first version used strnlen() and I redid it to be
simpler. I just figured that it doesn't take long to hit a zeroed
u8.
I'll resend all three strlen() patches to use strnlen().
regards,
dan carpenter
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-11-23 7:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 6:42 [patch] isdn: make sure strings are null terminated Dan Carpenter
2011-11-23 6:42 ` Dan Carpenter
2011-11-23 7:03 ` Eric Dumazet
2011-11-23 7:03 ` Eric Dumazet
2011-11-23 7:16 ` Dan Carpenter [this message]
2011-11-23 7:16 ` Dan Carpenter
2011-11-24 12:41 ` [patch v2] " Dan Carpenter
2011-11-24 12:41 ` Dan Carpenter
2011-11-29 23:40 ` David Miller
2011-11-29 23:40 ` David Miller
2011-11-23 8:25 ` [patch] " walter harms
2011-11-23 8:25 ` walter harms
2011-11-24 11:34 ` Dan Carpenter
2011-11-24 11:34 ` Dan Carpenter
2011-11-24 12:21 ` walter harms
2011-11-24 12:21 ` walter harms
2011-11-24 12:30 ` David Laight
2011-11-24 12:30 ` David Laight
2011-11-24 13:17 ` Karsten Keil
2011-11-24 13:17 ` Karsten Keil
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=20111123071619.GB3363@mwanda \
--to=dan.carpenter@oracle.com \
--cc=eric.dumazet@gmail.com \
--cc=isdn@linux-pingi.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.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.