projects
/
linux-block.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
mac_pton: Don't access memory over expected length
[linux-block.git]
/
lib
/
net_utils.c
diff --git
a/lib/net_utils.c
b/lib/net_utils.c
index af525353395d679001d98f73d1411e2d0dbbecda..c17201df3d08142bfc0e64b5903d0838afa710bf 100644
(file)
--- a/
lib/net_utils.c
+++ b/
lib/net_utils.c
@@
-6,10
+6,11
@@
bool mac_pton(const char *s, u8 *mac)
{
+ size_t maxlen = 3 * ETH_ALEN - 1;
int i;
/* XX:XX:XX:XX:XX:XX */
- if (str
len(s) < 3 * ETH_ALEN - 1
)
+ if (str
nlen(s, maxlen) < maxlen
)
return false;
/* Don't dirty result unless string is valid MAC. */