os.networkInterfaces uses uninitialized memory

  • Version: master
  • Platform: Linux 4.4.0-042stab133.2 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: libuv / os

Virtual network interfaces do not always get a hardware address assigned on Unix:

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: ::2/128 Scope:Compat
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

uv_interface_addresses does not initialize the phys_addr member in those cases. os.networkInterfaces still returns a mac property for those interfaces which relies on uninitialized memory and can thus contain any value. I guess this will need to be fixed in libuv first, or is there a way to detect whether the phys_addr field was initialized by libuv?

cc @nodejs/libuv