lkml.org 
[lkml]   [2006]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch] Off by one in drivers/usb/input/yealink.c
* Dmitry Torokhov (dtor@insightbb.com) wrote:
> On Wednesday 05 July 2006 20:49, Eric Sesterhenn / Snakebyte wrote:
> > I looked at this code several times too, and tried to reproduce the bug
> > with the following little program:
> >
> > #include <string.h>
> > int main(int argc, char **argv) {
> > char foo[] = "abcdef";
> > int i = 0;
> >
> > foo[strlen(foo)] = 'X';
> > do {
> > putchar(foo[i]);
> > } while (++i < sizeof(foo));
> > }
> >
> > Which clearly shows that the terminating '\0' gets printed too,
> > replaced by the X for better visibility, so the code
> > runs past the array, or did I fail to replicate the original
> > code somewhere?
> >
>
> What do you mean "the code runs past the array"? The size of array is 7
> (compiler allocates the space for terminating '\0') and the array is
> printed in its entirety.

arg, of course \0 is part of the array, sorry bothering you guys
with this stuff :( Another coverity report i analyzed incorrect... :(

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-06 16:43    [W:0.871 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site