summaryrefslogtreecommitdiffstats
path: root/lib/error.c
diff options
context:
space:
mode:
authorPrzemyslaw Szczerbik <przemekszczerbik@gmail.com>2016-05-30 21:26:00 (GMT)
committerThomas Haller <thaller@redhat.com>2016-06-24 17:32:25 (GMT)
commit424b3b6d0ddb809869d5ba87fa927ca086f8e5f8 (patch)
tree19c7b104fb49d77d8376d06ac10d3ca724fa55dd /lib/error.c
parent838f43faee39bb01e10036971bcadb0fac92ec6e (diff)
downloadlibnl-424b3b6d0ddb809869d5ba87fa927ca086f8e5f8.zip
libnl-424b3b6d0ddb809869d5ba87fa927ca086f8e5f8.tar.gz
libnl-424b3b6d0ddb809869d5ba87fa927ca086f8e5f8.tar.bz2
lib: return error on Netlink attribute length overflow
Netlink attribute length is defined as u16. It's possible to exceed nla_len when creating nested attributes. Storing incorrect length due to overflow will cause a reader to read only a part of nested attribute or skip it entirely. As a solution cancel the addition of a nested attribute when nla_len size is exceeded. Signed-off-by: Przemyslaw Szczerbik <przemek.szczerbik@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com> http://lists.infradead.org/pipermail/libnl/2016-May/002131.html
Diffstat (limited to 'lib/error.c')
-rw-r--r--lib/error.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/error.c b/lib/error.c
index f30b9a5..7fbd389 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -47,6 +47,7 @@ static const char *errmsg[NLE_MAX+1] = {
[NLE_NODEV] = "No such device",
[NLE_IMMUTABLE] = "Immutable attribute",
[NLE_DUMP_INTR] = "Dump inconsistency detected, interrupted",
+[NLE_ATTRSIZE] = "Attribute max length exceeded",
};
/**