Bug 710534

Summary: buffer overflow in btrfs if device name too long
Product: [Fedora] Fedora Reporter: Milan Broz <mbroz>
Component: btrfs-progsAssignee: Josef Bacik <josef>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: josef, mmahut, pvrabec
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-30 00:38: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:
Bug Depends On:    
Bug Blocks: 689509    
Attachments:
Description Flags
Proposed patch none

Description Milan Broz 2011-06-03 16:02:10 UTC
Created attachment 502846 [details]
Proposed patch

Description of problem:

btrfs overwrite memory for too long device paramater

e.g.
btrfs device scan $(awk 'BEGIN{$5090=OFS="x";print}')
...

** buffer overflow detected ***: btrfs terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f0ef2ea0607]
/lib64/libc.so.6(+0xf6580)[0x7f0ef2e9e580]
btrfs[0x402ec4]
btrfs[0x401b48]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7f0ef2dc943d]
btrfs[0x401df1]

Version-Release number of selected component (if applicable):
btrfs-progs-0.19-13.fc15.x86_64
(probably all versions)

See attached patch - it is not perfect fix (probably there should be error check if string is too long) but at least it avoids trivial strcpy() buffer overflow.

Comment 2 Fedora End Of Life 2013-04-03 15:25:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 3 Fedora Update System 2013-09-18 15:51:55 UTC
btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19

Comment 4 Eric Sandeen 2013-09-18 15:53:04 UTC
A new git snapshot of btrfs-progs has been pushed to F19 testing.  If possible, please re-test these bugs & feel free to close or comment as appropriate.

Thanks,
-Eric

Comment 5 Fedora Update System 2013-09-19 02:07:42 UTC
Package btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-17126/btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-09-30 00:38:35 UTC
btrfs-progs-0.20.rc1.20130917git194aa4a-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.