[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201005010012.14816.isdn@linux-pingi.de>
Date: Sat, 1 May 2010 00:12:14 +0200
From: Karsten Keil <isdn@...ux-pingi.de>
To: d binderman <dcb314@...mail.com>
Cc: netdev@...r.kernel.org
Subject: Re: possible off by one error in drivers/isdn/divert/divert_procfs.c
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists