]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: avoid NULL pointer dereference in route_add
authorMichael Chapman <mike@very.puzzling.org>
Tue, 16 Aug 2016 09:07:42 +0000 (19:07 +1000)
committerMichael Chapman <mike@very.puzzling.org>
Tue, 16 Aug 2016 09:07:42 +0000 (19:07 +1000)
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.

src/network/networkd-route.c

index cedaf47cf8e028a0d158b78979f28b1cfb8daede..82f9047ff610812dce8757487c14e7368ba7a192 100644 (file)
@@ -322,7 +322,8 @@ int route_add(
         } else
                 return r;
 
-        *ret = route;
+        if (ret)
+                *ret = route;
 
         return 0;
 }