Messages in this thread | | | Date | Thu, 6 Jul 2006 16:41:06 +0200 | From | Eric Sesterhenn / Snakebyte <> | Subject | Re: [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/
| |