mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-08 11:53:00 -04:00
Don't truncate hosts file path on Windows.
Since evutil_snprintf() (actually evutil_vsnprintf() called by it) will make sure the buffer is null-terminated by placing a null byte at len_out - 1, we need to pass the full length of the buffer; otherwise the path will end in "\\host" instead of "\\hosts".
This commit is contained in:
parent
a0b247cdc0
commit
d0dc861b88
4
evdns.c
4
evdns.c
@ -3555,8 +3555,8 @@ evdns_get_default_hosts_filename(void)
|
||||
|
||||
if (! SHGetSpecialFolderPathA(NULL, path, CSIDL_SYSTEM, 0))
|
||||
return NULL;
|
||||
len_out = strlen(path)+strlen(hostfile);
|
||||
path_out = mm_malloc(len_out+1);
|
||||
len_out = strlen(path)+strlen(hostfile)+1;
|
||||
path_out = mm_malloc(len_out);
|
||||
evutil_snprintf(path_out, len_out, "%s%s", path, hostfile);
|
||||
return path_out;
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user