From: Steve Dickson Date: Mon, 25 Jan 2010 18:09:04 +0000 (-0500) Subject: Teach nfs_compare_sockaddr() to handle NULL arguments. X-Git-Tag: nfs-utils-1-2-2~17 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=6318d601cf182d2848d397af323ca9c4fbdecb97;p=nfs-utils.git Teach nfs_compare_sockaddr() to handle NULL arguments. Reviewed-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/support/include/sockaddr.h b/support/include/sockaddr.h index 732514b..9af2543 100644 --- a/support/include/sockaddr.h +++ b/support/include/sockaddr.h @@ -20,6 +20,7 @@ #ifndef NFS_UTILS_SOCKADDR_H #define NFS_UTILS_SOCKADDR_H +#include #include #include #include @@ -223,6 +224,9 @@ compare_sockaddr6(__attribute__ ((unused)) const struct sockaddr *sa1, static inline _Bool nfs_compare_sockaddr(const struct sockaddr *sa1, const struct sockaddr *sa2) { + if (sa1 == NULL || sa2 == NULL) + return false; + if (sa1->sa_family == sa2->sa_family) switch (sa1->sa_family) { case AF_INET: