summaryrefslogtreecommitdiff
path: root/src/node_os.cc
diff options
context:
space:
mode:
authorMartin Bark <martin@barkynet.com>2015-12-14 21:36:21 +0000
committerRod Vagg <rod@vagg.org>2016-01-04 15:04:16 +1100
commit028194b576e178a5be35cfb77991f420201242bd (patch)
treefe79e29305d6ee4f28bc4dfbc09428ec1dc75129 /src/node_os.cc
parentac153bd2a6f45e5dedebacab362135a82ac08dbd (diff)
downloadnode-new-028194b576e178a5be35cfb77991f420201242bd.tar.gz
os: fix crash in GetInterfaceAddresses
If uv_interface_addresses() returns UV_ENOSYS then interfaces and count are uninitialised. This can cause a segmentation fault inside GetInterfaceAddresses when it tries to use the invalid interfaces[]. Fix the issue by returning from GetInterfaceAddresses on the UV_ENOSYS error. This issue was observed when using uCLibc-ng version 1.0.9 because uv_interface_addresses() in deps/uv/src/unix/linux-core.c incorrectly undefines HAVE_IFADDRS_H. Signed-off-by: Martin Bark <martin@barkynet.com> PR-URL: https://github.com/nodejs/node/pull/4272 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to 'src/node_os.cc')
-rw-r--r--src/node_os.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_os.cc b/src/node_os.cc
index a100090748..92f53a9c40 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -200,7 +200,7 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
ret = Object::New(env->isolate());
if (err == UV_ENOSYS) {
- args.GetReturnValue().Set(ret);
+ return args.GetReturnValue().Set(ret);
} else if (err) {
return env->ThrowUVException(err, "uv_interface_addresses");
}