Apparently it is a defensive programming to make sure that string is
null-terminated also in cases where default_sys_path length equals
to win_sys_path.

So, ACK.



ke 3. lokak. 2018 klo 11.53 Lev Stipakov (lstipa...@gmail.com) kirjoitti:

> Hi,
>
>
>> +    if (!GetSystemDirectoryW(win_sys_path, _countof(win_sys_path)))
>> +    {
>> +        wcsncpy(win_sys_path, default_sys_path, _countof(win_sys_path));
>> +        win_sys_path[_countof(win_sys_path) - 1] = L'\0';
>> +    }
>>
>
> Is there need in adding null terminator to win_sys_path?
>
> Since it is static, it will be initialized with zeroes at startup.
> Besides, wcsncpy also adds null terminator.
>
> --
> -Lev
>


-- 
-Lev
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to