Re: Coverity reports on possible overruns of static arrays

2006-11-16 Thread Michael Stefaniuc
Hey, Paul Vriens wrote: > we have quite a few places in the code where we do: > > WCHAR param[any-value]; > > len = sizeof(param) / sizeof(WCHAR); And there lies the next potential bug. If somebody changes the type of param this will result in a wrong length. For this reason the Linux Kernel guy

Re: Coverity reports on possible overruns of static arrays

2006-11-15 Thread Eric Pouech
Paul Vriens a écrit : Hi, we have quite a few places in the code where we do: WCHAR param[any-value]; len = sizeof(param) / sizeof(WCHAR); param[len] = '\0'; and of course more-or-less the same for CHAR arrays. This could lead (and the example does) to writing behind the end of param. I've

Coverity reports on possible overruns of static arrays

2006-11-15 Thread Paul Vriens
Hi, we have quite a few places in the code where we do: WCHAR param[any-value]; len = sizeof(param) / sizeof(WCHAR); param[len] = '\0'; and of course more-or-less the same for CHAR arrays. This could lead (and the example does) to writing behind the end of param. I've submitted two patches f