Commit f4e37670 authored by Jean Tourrilhes's avatar Jean Tourrilhes Committed by Stephen Hemminger

[IRDA]: Fix compiler warning in af_irda.c

parent d80fb43e
...@@ -1891,11 +1891,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname, ...@@ -1891,11 +1891,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
case IAS_STRING: case IAS_STRING:
/* Should check charset & co */ /* Should check charset & co */
/* Check length */ /* Check length */
if(ias_opt->attribute.irda_attrib_string.len > /* The length is encoded in a __u8, and
IAS_MAX_STRING) { * IAS_MAX_STRING == 256, so there is no way
kfree(ias_opt); * userspace can pass us a string too large.
return -EINVAL; * Jean II */
}
/* NULL terminate the string (avoid troubles) */ /* NULL terminate the string (avoid troubles) */
ias_opt->attribute.irda_attrib_string.string[ias_opt->attribute.irda_attrib_string.len] = '\0'; ias_opt->attribute.irda_attrib_string.string[ias_opt->attribute.irda_attrib_string.len] = '\0';
/* Add a string attribute */ /* Add a string attribute */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment