nano 2.5.3-2 on Xenial crashes with long paths on lockfiles

Bug #1641592 reported by Antti Tönkyrä
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
nano (Ubuntu)
Fix Released
High
Unassigned
Xenial
Fix Released
High
Brian Murray

Bug Description

# lsb_release -rd
Description: Ubuntu 16.04.1 LTS
Release: 16.04
# apt-cache policy nano
nano:
  Installed: 2.5.3-2
  Candidate: 2.5.3-2

Reproducer:
1. # nano -G 999999999999999999999999999999999999999999999999999999999999999999999999999
2. <ctrl-z>
3. # nano -G 999999999999999999999999999999999999999999999999999999999999999999999999999
4. <answer y/n to the lockfile question>
5. <nano should segfault>

Quick dissection:
Looking at function do_lockfile in files.c, it seems that promptstr is statically allocated to 128 characters. Now with a sufficiently long filename, the following sprintf() call will overflow the allocated promptstr buffer and corrupt memory.

summary: - nano 2.5.3-2 on Xenial crashes when trying to access a lockfile
+ nano 2.5.3-2 on Xenial crashes with long paths on lockfiles
Revision history for this message
Benno Schulenberg (bennoschulenberg) wrote :

This is a duplicate of upstream bug https://savannah.gnu.org/bugs/?47511 .

The problem was fixed in git, commit fb9585e. See attached patch. The fix is in version 2.6.0 and higher.

Thanks for reporting.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "fixes the crash when finding lockfiles for long names" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in nano (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in nano (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → High
Changed in nano (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded this to the -proposed queue for review by the SRU team.

Changed in nano (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Antti, or anyone else affected,

Accepted nano into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/nano/2.5.3-2ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in nano (Ubuntu Xenial):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Antti Tönkyrä (atonkyra) wrote :
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nano - 2.5.3-2ubuntu2

---------------
nano (2.5.3-2ubuntu2) xenial-proposed; urgency=medium

  * Apply upstream patch to allocate enough space for the prompt when finding
    a lock file. (LP: #1641592)

 -- Brian Murray <email address hidden> Tue, 14 Feb 2017 15:10:03 -0800

Changed in nano (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for nano has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.