From 1bafcd847a2bdaea7aebdb212bbb480eaeee7ede Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 27 Oct 2010 04:33:15 +0000 Subject: libglusterfs: fix buffer overflow in gf_string2int() Signed-off-by: Csaba Henk Signed-off-by: Anand V. Avati BUG: 2022 (gf_string2int() overflows target pointer) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2022 --- libglusterfs/src/common-utils.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit