]> granicus.if.org Git - libnl/commit
lib: accept %NULL arguments for nl_addr_cmp()
authorThomas Haller <thaller@redhat.com>
Tue, 27 Aug 2019 12:43:54 +0000 (14:43 +0200)
committerThomas Haller <thaller@redhat.com>
Tue, 27 Aug 2019 12:46:21 +0000 (14:46 +0200)
commit34708e2ef048f3788f3f2d5018735b27b156d244
tree21b621aefb5e8d4e6d9aecdc2bfc905e11b48728
parent194069516dcd16071314c110b18c3f325eac414f
lib: accept %NULL arguments for nl_addr_cmp()

Just be more forgiving. Also, this avoids a coverity warning:

    Error: FORWARD_NULL (CWE-476): [#def1]
    libnl-3.4.0/lib/route/addr.c:502: var_compare_op: Comparing "a->a_peer" to null implies that "a->a_peer" might be null.
    libnl-3.4.0/lib/route/addr.c:513: var_deref_model: Passing null pointer "a->a_peer" to "nl_addr_cmp", which dereferences it.
    libnl-3.4.0/lib/addr.c:587:8: deref_parm: Directly dereferencing parameter "a".
    #  585|   int nl_addr_cmp(const struct nl_addr *a, const struct nl_addr *b)
    #  586|   {
    #  587|->  int d = a->a_family - b->a_family;
    #  588|
    #  589|    if (d == 0) {

https://bugzilla.redhat.com/show_bug.cgi?id=1606988
lib/addr.c