Coverity reports on possible overruns of static arrays

Paul Vriens paul.vriens.wine at gmail.com
Wed Nov 15 12:13:47 CST 2006


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 for this, but I'm not sure just doing:

param[len - 1] = '\0'; 

is the correct/good approach.

Any idea's?

Cheers,

Paul.









More information about the wine-devel mailing list