]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh-network: Avoid possible NULL deref in cmdNetworkDHCPLeases
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Jun 2016 09:32:09 +0000 (11:32 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Jun 2016 13:56:08 +0000 (15:56 +0200)
commit5ec2b0cca5530bb911536d5e135e17e24490adbc
tree7306c6f6e7110a96cec121930e7d2be319f3d8b0
parente4fd42d87bb4d4c833614bc62be3d6e4b5701c94
virsh-network: Avoid possible NULL deref in cmdNetworkDHCPLeases

Problem is, localtime_r() returns a pointer to converted time or
NULL in case of an error. But checking the glibc sources, error
will occur iff a NULL has been passed as an either of arguments
the function takes. But GCC fails to see that:

../../tools/virsh-network.c: In function 'cmdNetworkDHCPLeases':
../../tools/virsh-network.c:1370:12: error: potential null pointer dereference [-Werror=null-dereference]
         ts = *localtime_r(&expirytime_tmp, &ts);
         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-network.c