[PATCH] net: allow newline terminated IP addresses in in_aton
authorMitch Williams <mitch.a.williams@intel.com>
Wed, 9 Nov 2005 18:34:01 +0000 (10:34 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Sun, 13 Nov 2005 19:48:17 +0000 (14:48 -0500)
in_aton() gives weird results if it sees a newline at the end of the
input. This patch makes it able to handle such input correctly.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Acked-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/core/utils.c

index 7b5970fc9e407f7886332cba4d95b8ee3cf2c011..587eb7787debf04561517a0e0f0a070d5bff84e3 100644 (file)
@@ -175,7 +175,7 @@ __u32 in_aton(const char *str)
                if (*str != '\0')
                {
                        val = 0;
-                       while (*str != '\0' && *str != '.')
+                       while (*str != '\0' && *str != '.' && *str != '\n')
                        {
                                val *= 10;
                                val += *str - '0';