[PATCH] dix: fix NULL pointer dereferenced in memset

Jamey Sharp jamey at minilop.net
Sat Jun 12 08:23:09 PDT 2010


Hi Tiago!

On Sat, Jun 12, 2010 at 7:39 AM, Tiago Vignatti
<tiago.vignatti at nokia.com> wrote:
> Apparently memset doesn't complain if the memory area is null (addr) and
> something is being written there. Even though, this patch guarantees that
> nothing is written at 0x0 memory address.

I'm confused by this comment. Did you get a segfault, or what? What do
you mean by "memset doesn't complain", and why is the patch necessary?

I've just checked POSIX and C99, and neither one specifies anything
about memset's behavior when length is 0 and address is null. Seems
like no correct implementation could possibly dereference the null
pointer though...

> Honestly I didn't check if the code surrounding this hunk of code really needs
> or not this memset. I created the patch focused only in the actual problem.

_dixInitPrivates does need the memset. The privates storage is
promised to be zero-initialized.

Jamey


More information about the xorg-devel mailing list