Bug 650119

Summary: rexec gives error "can't allocate memory!" if you specify the -p parameter
Product: [Fedora] Fedora Reporter: Marcel van Groenigen <pfismvg>
Component: rshAssignee: Adam Tkac <atkac>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: atkac, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rsh-0.17-63.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-16 23:16:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcel van Groenigen 2010-11-05 09:34:41 UTC
As soon as you run rexec using the -p param, the program crashes.

# ./rexec -p test -l test localhost ls
./rexec: can't allocate memory!

If I look in the source rexec.c on line 318 there is the following statement

        *passwd = malloc((char *)malloc((passlen+1)*sizeof(char)));

I dont know much about C, so I may have this completely wrong.
but here it allocates memory malloc((passlen+1)*sizeof(char)) and then take the pointer to that memory and use that pointer as a size to allocate more memory :)?
That line probably should be:

        *passwd = malloc((passlen+1)*sizeof(char)));

If I recompile after this change all looks OK, and rexec works great.
this problem seems to exist in fedora 13 and fedora 14

Comment 1 Fedora Update System 2010-11-08 12:25:26 UTC
rsh-0.17-63.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/rsh-0.17-63.fc14

Comment 2 Fedora Update System 2010-11-08 22:47:39 UTC
rsh-0.17-63.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update rsh'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/rsh-0.17-63.fc14

Comment 3 Fedora Update System 2010-11-16 23:16:31 UTC
rsh-0.17-63.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.