netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karsten Keil <isdn@linux-pingi.de>
To: d binderman <dcb314@hotmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: possible off by one error in drivers/isdn/divert/divert_procfs.c
Date: Sat, 1 May 2010 00:12:14 +0200	[thread overview]
Message-ID: <201005010012.14816.isdn@linux-pingi.de> (raw)
In-Reply-To: <BLU108-W15F33D55974CB43800BEB59C000@phx.gbl>

On Freitag, 30. April 2010 23:15:17 d binderman wrote:
> Hello there,
> 
> I've just been looking at the Linux kernel linux-2.6.34-rc6.  I notice the
> source code in file drivers/isdn/divert/divert_procfs.c, around line 50 is
> 
>         if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp),
>  GFP_ATOMIC))) return;        /* no memory */
>         strcpy(ib->info_start, cp);     /* set output string */
> 
> 
> Shouldn't that be
> 
>         if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp) + 1,
>  GFP_ATOMIC))) return;        /* no memory */
>         strcpy(ib->info_start, cp);     /* set output string */
> 
> +1 for the zero byte ?
> 

No the struct divert_info already add 2 bytes as size of the info_start field.

So in real it has one byte more as needed.

Same think with the code in drivers/isdn/divert/divert_procfs.c

Karsten

           reply	other threads:[~2010-04-30 22:12 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <BLU108-W15F33D55974CB43800BEB59C000@phx.gbl>]

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=201005010012.14816.isdn@linux-pingi.de \
    --to=isdn@linux-pingi.de \
    --cc=dcb314@hotmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).