On Mon, 8 Aug 2011, Jeremy Leibs wrote:
> The basic problem seems to be that PATH_HOSTS isn't initialized. If the
> call to "RegOpenKeyEx" fails, PATH_HOSTS makes it down to "strcat" before
> being initialized. If there are no null characters in the first MAX_PATH
> characters, strcat copies off the end of the array and things end up
> corrupted.
>
> The valid fix is to clear PATH_HOSTS. ares_gethostbyaddr contains the same
> code, so I fixed it there as well.
I don't understand. PATH_HOSTS is a local array and it gets a zero stored in
the first byte immediately after the declaration, and thus strcat() should
work fine on that buffer even if RegOpenKeyEx() fails - just provide a weird
final path.
What am I missing? Why do you need to zero the entire array?
-- / daniel.haxx.seReceived on 2011-08-09