Skip to content

Commit

Permalink
os: fix crash in GetInterfaceAddresses
Browse files Browse the repository at this point in the history
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 <[email protected]>
PR-URL: #4272
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
  • Loading branch information
martinbark authored and Myles Borins committed Jan 19, 2016
1 parent f613b30 commit 8ce6843
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 8ce6843

Please sign in to comment.