summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-03-03 02:14:37 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-04 02:04:23 -0800
commit789a2aa2276bd5d0986aa60dd7407d659ca8e056 (patch)
tree7fe261e6979d1a5c042ae372e2bacc13a3d1b8f0
parent1ce31a9a12a17b0dc3a2a0d99f3a6cfa00852cea (diff)
transport/socket: fix to valid_ipv6_address.v3.0.3rc1
- 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 <dmneal@wand.net.nz>, for pointing this out. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> 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
-rw-r--r--libglusterfs/src/xlator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 44494a9..bc36173 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;
}