diff options
| author | Gaurav Yadav <gyadav@redhat.com> | 2017-05-22 23:25:47 +0530 | 
|---|---|---|
| committer | Raghavendra Talur <rtalur@redhat.com> | 2017-06-20 04:56:08 +0000 | 
| commit | 89b55994bf84a489b10b3b40d3a6245681eb4c4c (patch) | |
| tree | 2bf6ba029e531ccef105e0bf8f5bcead568e6e46 /libglusterfs | |
| parent | abaf577626650edb4b9dfdddd43ba04a2a8e8ef3 (diff) | |
libglusterfs : Fix crash in glusterd while peer probing
glusterd crashes when port is being set explcitly to a
range which is outside greater than short data type range.
Eg. sysctl net.ipv4.ip_local_reserved_ports="49152-49156"
In above case glusterd crashes while parsing the port.
With this fix glusterd will be able to handle port range
between INT_MIN to INT_MAX
> Reviewed-on: https://review.gluster.org/17359
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>  Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Change-Id: I7c75ee67937b0e3384502973d96b1c36c89e0fe1
BUG: 1459760
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Reviewed-on: https://review.gluster.org/17494
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'libglusterfs')
| -rw-r--r-- | libglusterfs/src/common-utils.c | 10 | 
1 files changed, 5 insertions, 5 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index f457c55df09..8525799f40e 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -3049,14 +3049,14 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)  {          gf_boolean_t    result      = _gf_false;          char            *range_port = NULL; -        int16_t         tmp_port1   = -1; -        int16_t         tmp_port2   = -1; +        int32_t         tmp_port1   = -1; +        int32_t         tmp_port2   = -1;          if (strstr (blocked_port, "-") == NULL) {                  /* get rid of the new line character*/                  if (blocked_port[strlen(blocked_port) -1] == '\n')                          blocked_port[strlen(blocked_port) -1] = '\0'; -                if (gf_string2int16 (blocked_port, &tmp_port1) == 0) { +                if (gf_string2int32 (blocked_port, &tmp_port1) == 0) {                          if (tmp_port1 > ceiling                              || tmp_port1 < 0) {                                  gf_msg ("glusterfs-socket", GF_LOG_WARNING, 0, @@ -3082,7 +3082,7 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)                          result = _gf_true;                          goto out;                  } -                if (gf_string2int16 (range_port, &tmp_port1) == 0) { +                if (gf_string2int32 (range_port, &tmp_port1) == 0) {                          if (tmp_port1 > ceiling)                                  tmp_port1 = ceiling;                          if (tmp_port1 < 0) @@ -3096,7 +3096,7 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling)                  /* get rid of the new line character*/                  if (range_port[strlen(range_port) -1] == '\n')                          range_port[strlen(range_port) - 1] = '\0'; -                if (gf_string2int16 (range_port, &tmp_port2) == 0) { +                if (gf_string2int32 (range_port, &tmp_port2) == 0) {                          if (tmp_port2 > ceiling)                                  tmp_port2 = ceiling;                          if (tmp_port2 < 0)  | 
