From: Michael Chapman Date: Tue, 16 Aug 2016 09:07:42 +0000 (+1000) Subject: networkd: avoid NULL pointer dereference in route_add X-Git-Tag: v232~284^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=856e309d7b18cabe18c845bdf57e92958343a9ec;p=thirdparty%2Fsystemd.git networkd: avoid NULL pointer dereference in route_add If no result parameter is provided, do not attempt to write the found/newly-created route to it. This is presently not an issue as all callers currently provide a non-NULL result parameter, however we should do this for symmetry with address_add and future code robustness. --- diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index cedaf47cf8e..82f9047ff61 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -322,7 +322,8 @@ int route_add( } else return r; - *ret = route; + if (ret) + *ret = route; return 0; }