pfgerard/cppcheck — comment on commit 67c936b8b2fecc22a33ebdfd83fbaaa6f0026797
File: lib/checkbufferoverrun.cpp line 182
By pfgerard:

You're right, 'accessing' would provide a more accurate description. The
examples you cite are valid uses of memset, the test I was working against
was an instance where a value greater than sizeof(int) was being used to
memset an int.
I'll put additional tests in to cover some acceptable memset scenarios and
then refine the checks to compare more specifically the value in the third
argument against the size of the first.

On Mon, Jan 23, 2012 at 5:28 PM, Kimmo Varis <
reply@reply.github.com
> wrote:

> This message does not make sense. `memset()` is not allocating any memory.
> You probably mean *accessing*. And it is perfectly OK to `memset()` stack
> variables. For example:
>
> void foo()
> {
> char bar[20];
> memset(bar, 0, 20);
> }
>
> or even:
>
>
> void foo()
> {
> int bar;
> memset(&bar, 0, sizeof(int));
> }
>
> ---
> Reply to this email directly or view it on GitHub:
>
> https://github.com/pfgerard/cppcheck/commit/67c936b8b2fecc22a33ebdfd83fbaaa6f0026797#commitcomment-892955
>