[PATCH] net: Allow mac_pton() to work on non-NULL terminated strings
Alexey Dobriyan
adobriyan at gmail.com
Fri Feb 23 12:41:04 PST 2018
On Fri, Feb 23, 2018 at 09:17:48PM +0100, Stefan Hellermann wrote:
> @@ -8,10 +8,6 @@ bool mac_pton(const char *s, u8 *mac)
> {
> int i;
>
> - /* XX:XX:XX:XX:XX:XX */
> - if (strlen(s) < 3 * ETH_ALEN - 1)
> - return false;
> -
> /* Don't dirty result unless string is valid MAC. */
> for (i = 0; i < ETH_ALEN; i++) {
> if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1]))
Short string will bail in the loop, indeed.
Reviewed-by: Alexey Dobriyan <adobriyan at gmail.com>
More information about the linux-arm-kernel
mailing list