summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-27 12:58:35 (GMT)
committerThomas Haller <thaller@redhat.com>2019-08-27 12:58:35 (GMT)
commitf3d5c44d21243d5eb59bfc2878d4977df2fd1369 (patch)
treec7f8ef37399a00ab8289bdefdec58e987d818751
parent34708e2ef048f3788f3f2d5018735b27b156d244 (diff)
downloadlibnl-f3d5c44d21243d5eb59bfc2878d4977df2fd1369.zip
libnl-f3d5c44d21243d5eb59bfc2878d4977df2fd1369.tar.gz
libnl-f3d5c44d21243d5eb59bfc2878d4977df2fd1369.tar.bz2
lib: fix error code from nfnl_exp_build_message()
Otherwise we return success but don't actually set the output result. This can lead to a crash, in case of out-of-memory. Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1606988
-rw-r--r--lib/netfilter/exp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/netfilter/exp.c b/lib/netfilter/exp.c
index 0690cee..d475861 100644
--- a/lib/netfilter/exp.c
+++ b/lib/netfilter/exp.c
@@ -492,6 +492,8 @@ static int nfnl_exp_build_message(const struct nfnl_exp *exp, int cmd, int flags
return 0;
nla_put_failure:
+ err = -NLE_NOMEM;
+
err_out:
nlmsg_free(msg);
return err;