aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2014-06-30 15:16:58 +0200
committerAnders Roxell <anders.roxell@linaro.org>2014-06-30 15:16:58 +0200
commitcbd9c08135ee4510c4d58a08ba86ee563d238525 (patch)
treea2f5e83bf44807cbf2f88a040bb250c8610d8813 /lib
parentb01e6c9252597da56540419fc56dcae342628714 (diff)
parent798d3c532b82dce20bcdc512572f542093142d02 (diff)
Merge tag 'v3.14.2' into v3.14-rt
This is the 3.14.2 stable release
Diffstat (limited to 'lib')
-rw-r--r--lib/nlattr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 18eca7809b08..fc6754720ced 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -303,9 +303,15 @@ int nla_memcmp(const struct nlattr *nla, const void *data,
*/
int nla_strcmp(const struct nlattr *nla, const char *str)
{
- int len = strlen(str) + 1;
- int d = nla_len(nla) - len;
+ int len = strlen(str);
+ char *buf = nla_data(nla);
+ int attrlen = nla_len(nla);
+ int d;
+ if (attrlen > 0 && buf[attrlen - 1] == '\0')
+ attrlen--;
+
+ d = attrlen - len;
if (d == 0)
d = memcmp(nla_data(nla), str, len);