diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-04-24 11:03:01 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-04-24 11:03:01 -0400 |
commit | 42c064393b9881c1d7f5af214aba903259144c0e (patch) | |
tree | d78f5badfb660e8c5858c9172f15cc7127350fd9 /lib | |
parent | a507eb702e0d649168fa2e8ac12573239d786554 (diff) | |
parent | f512eefd5cde0ad21bd99bbfe4dc70b62805838e (diff) |
Merge tag 'v3.10.37' into v3.10-rt
This is the 3.10.37 stable release
Diffstat (limited to 'lib')
-rw-r--r-- | lib/nlattr.c | 10 |
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); |