summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorben Römer <36536632+TarEnethil@users.noreply.github.com>2022-10-17 12:55:48 (GMT)
committerThomas Haller <thaller@redhat.com>2023-07-24 17:38:34 (GMT)
commit6519a9173f900b364f014a2321a17aa6bf652e6d (patch)
tree96dc6b89b12805246c90fc548122c2dab9a6c5ac
parentb5b04aab845ce65792af70886f634a86e83846ee (diff)
downloadlibnl-6519a9173f900b364f014a2321a17aa6bf652e6d.zip
libnl-6519a9173f900b364f014a2321a17aa6bf652e6d.tar.gz
libnl-6519a9173f900b364f014a2321a17aa6bf652e6d.tar.bz2
route/link: prevent segfault in af_request_type()
Check that ops->ao_override_rtm() is set before using it, which prevents a segfault whenever af_request_type() is called with a type that has ops but that does not initialize said function in their ops struct. https://github.com/thom311/libnl/pull/333
-rw-r--r--lib/route/link.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/route/link.c b/lib/route/link.c
index 5e80629..0d7a63a 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -115,7 +115,7 @@ static int af_request_type(int af_type, struct rtnl_link *changes)
struct rtnl_link_af_ops *ops;
ops = rtnl_link_af_ops_lookup(af_type);
- if (ops && ops->ao_override_rtm(changes))
+ if (ops && ops->ao_override_rtm && ops->ao_override_rtm(changes))
return RTM_SETLINK;
return RTM_NEWLINK;