From 56ccc0e5e9a0c1032e789d61dfb89a20ff3cbe7f Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 3 Mar 2010 02:16:09 +0000 Subject: transport/socket: fix to valid_ipv6_address. - while checking for hexadecimal numbers, strtol on valid strings of hexadecimal numbers will return a NULL string in endptr (but not a NULL endptr). Thanks to Donald Neal , for pointing this out. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 693 (glusterfs 3.0.2 will not listen on IPv6 address) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=693 --- libglusterfs/src/xlator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 398fb9baf..eeb048f81 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -190,7 +190,8 @@ valid_ipv6_address (char *address, int length) { hex_numbers++; value = strtol (prev, &endptr, 16); - if ((value > 0xffff) || (value < 0) || (endptr != NULL)) { + if ((value > 0xffff) || (value < 0) + || (endptr != NULL && *endptr != '\0')) { ret = 0; goto out; } -- cgit