unix: check for NULL in uv_os_unsetenv for parameter name

Fixes segfault of unit test on musl (AlpineLinux).
Add a check for parameter like uv_os_setenv do.

PR-URL: https://github.com/libuv/libuv/pull/1409
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
André Klitzing 2017-07-07 22:41:12 +02:00 committed by Santiago Gimeno
parent d63030b0ba
commit ad1c828827
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -1292,6 +1292,9 @@ int uv_os_setenv(const char* name, const char* value) {
int uv_os_unsetenv(const char* name) {
if (name == NULL)
return -EINVAL;
if (unsetenv(name) != 0)
return -errno;