[PATCH 1/4] Check for null pointers before strcmp. (LLVM/Clang)

Lauri Kenttä lauri.kentta at gmail.com
Fri Jun 10 17:15:42 CDT 2011


On Fri, 10 Jun 2011 14:19:43 -0700, Juan Lang wrote:
> This change doesn't accomplish anything.

Yes it does. It makes Clang happy and avoids a null pointer dereference 
in case the tests are failing. (Even if they're passing now, someone 
might break them in future.)

> In the first place, the previous ok which you did not change already 
> ensures pdst is not NULL.

Yes, I'm sure it does, but that has really nothing to do with this. The 
next line is run in either case, and if pdst is null, it will cause a 
segfault.

> Second, the ok output message also dereferences pdst by printing it

That's not true. "%s" formats null pointers as "(null)" instead of 
dereferencing anything. Feel free to try it yourself or see 
ntdll/printf.c:225 for such a check.

> Really, I suggest you just ignore this warning, it's not worth the 
> extra baggage.

It would be a lot easier to find and fix real things if there weren't a 
thousand false ones hanging around. But if you feel it's better to have 
a lot of warnings and some possible bugs than a lot of checks and no 
bugs, then maybe I'll not waste any more time "fixing" them.

-- 
Lauri



More information about the wine-devel mailing list