Bug 763754 (GLUSTER-2022)

Summary: gf_string2int() overflows target pointer
Product: [Community] GlusterFS Reporter: Csaba Henk <csaba>
Component: coreAssignee: Csaba Henk <csaba>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: mainlineCC: anush, gluster-bugs, vijay
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Anand Avati 2010-10-27 08:13:33 UTC
PATCH: http://patches.gluster.com/patch/5581 in master (libglusterfs: fix buffer overflow in gf_string2int())

Comment 1 Csaba Henk 2010-10-27 09:57:14 UTC
gf_string2int()is the same as gf_string2long(), just beforehand it casts the target pointer to long. On a 64 bit machine this means that an 8 bytes region will be written by a call to it. In the standard use-case we use an int pointer as target, which means we are allowed to write 4 bytes only.

An example of it: in glusterd-store.c, we can see

  gf_string2int (value, &brickinfo->port);

this overflows to the subsequent field in brickinfo, ie. brickinfo->logfile.