summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorCsaba Henk <csaba@lowlife.hu>2010-10-27 04:33:15 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-10-27 04:13:30 -0700
commit1bafcd847a2bdaea7aebdb212bbb480eaeee7ede (patch)
tree69ec07739f4c5e045772338fd0a7df227477e7b5 /libglusterfs/src/common-utils.c
parent38c91384861f29f97c3f564a36ee799f1eb57cc1 (diff)
libglusterfs: fix buffer overflow in gf_string2int()
Signed-off-by: Csaba Henk <csaba@lowlife.hu> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2022 (gf_string2int() overflows target pointer) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2022
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index e4c7e2c31d5..6f40e7a6420 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -965,7 +965,13 @@ gf_string2ulong (const char *str, unsigned long *n)
int
gf_string2int (const char *str, int *n)
{
- return _gf_string2long (str, (long *) n, 0);
+ long l = 0;
+ int ret = 0;
+
+ ret = _gf_string2long (str, &l, 0);
+
+ *n = l;
+ return ret;
}
int