Bug 597135
Summary: | guestfish write-file cmd does not check "size" parameter | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | Pengzhen Cao <pcao> | ||||
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | ||||
Status: | CLOSED UPSTREAM | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | low | ||||||
Version: | unspecified | CC: | mbooth, virt-maint | ||||
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: | 2011-07-14 19:12:06 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: | |||||||
Attachments: |
|
Patch posted upstream: https://www.redhat.com/archives/libguestfs/2010-June/msg00012.html libguestfs-1.2.9-1.el5 has been submitted as an update for Fedora EPEL 5. http://admin.fedoraproject.org/updates/libguestfs-1.2.9-1.el5 libguestfs-1.2.9-1.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/libguestfs-1.2.9-1.fc13 This patch has been pushed upstream. If this needs to be fixed for RHEL 5 / 6, please clone this bug and adjust the Product accordingly. libguestfs-1.2.9-1.el5.1 has been submitted as an update for Fedora EPEL 5. http://admin.fedoraproject.org/updates/libguestfs-1.2.9-1.el5.1 |
Created attachment 417508 [details] guestfish write-file cmd logs Description of problem: guestfish write-file cmd does not check the size parameter, this cause two issues: 1. if size is greater than the actual string length, random content will returned and written to the file, I guess it just overflow the char* pointer address and dump the XDR buffer to file 2. if size is negative or a great value that exceeds XDR buffer,will cause "bad address" error Version-Release number of selected component (if applicable): How reproducible: 100% Steps to Reproduce: 1. run guestfish with an existing image 2. issue cmd " write-file /t.txt "abcdefg" SIZE 3. SIZE could be some vaule great than the string leng, such as 10000 Actual results: random content will return with size larger than actual string length Expected results: Should not return random content nor "bad address" error, size should be checked in do_write_file function Additional info: logs appended