From: Matthew Iselin <[email protected]>

Signed-off-by: Matthew Iselin <[email protected]>
---
 src/net/ipv6.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/net/ipv6.c b/src/net/ipv6.c
index fe8c7af..bfd78ca 100644
--- a/src/net/ipv6.c
+++ b/src/net/ipv6.c
@@ -542,18 +542,12 @@ char * inet6_ntoa ( struct in6_addr in6 ) {
 int inet6_aton ( const char *cp, struct in6_addr *inp ) {
        char convbuf[40];
        char *tmp = convbuf, *next = convbuf;
-       size_t i = 0, len = strlen ( cp );
+       size_t i = 0;
        int ok;
        char c;
        
        /* Verify a valid address. */
-       if ( ! len ) {
-               return 0;
-       }
-       
-       for ( ; i < len; i++ ) {
-               c = cp[i];
-               
+       while ( ( c = cp[i++] ) ) {
                ok = c == ':';
                ok = ok || ( ( c >= '0' ) && ( c <= '9' ) );
                ok = ok || ( ( c >= 'a' ) && ( c <= 'f' ) );
@@ -563,6 +557,9 @@ int inet6_aton ( const char *cp, struct in6_addr *inp ) {
                        return 0;
                }
        }
+       if ( ! i ) {
+               return 0;
+       }
        
        strcpy ( convbuf, cp );
        
-- 
1.7.2.5

_______________________________________________
gPXE-devel mailing list
[email protected]
http://etherboot.org/mailman/listinfo/gpxe-devel

Reply via email to