bugGNU nano - Bugs: bug #30671, nano segfaults when interactively...


bug #30671: nano segfaults when interactively providing filenames

Submitted by:  None
Submitted on:  Fri 06 Aug 2010 03:44:11 PM UTC  
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 22 Feb 2014 09:01:25 PM UTC, comment #1:

Thanks for the fix. It's in SVN now.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 06 Aug 2010 03:44:11 PM UTC, original submission:

I'm crosscompiling nano to run on a Fritz!Box.

Compiling without --enable-tiny results in a segfault when trying to save a file by overwriting (file to overwrite is prompted). The binary compiled with option --enable-tiny works great (at least in that matter).

I found a bug in file files.c on line 1508:
if (openfile->current_stat == NULL && !tmp && realexists)
stat(realname, openfile->current_stat);

On my Ubuntu this is not a problem, probably due to the implementation of stat, but on my Fritz!Box it fails. That is obviously because openfile->current_stat is NULL (just checked above). So a malloc should be called here:
if (openfile->current_stat == NULL && !tmp && realexists) {
openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
stat(realname, openfile->current_stat);
just like on lines 153 and 1874.

A patch is attached to this report, hope you find it useful.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #21160:  files.c.patch added by None (757B - text/x-patch - patch should fix the bug)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Feb 2014 09:01:25 PM UTCbensStatusNone=>Fixed
      Assigned toNone=>bens
      Summary[BUG] nano segfaults when interactively providing filenames=>nano segfaults when interactively providing filenames
    Fri 06 Aug 2010 03:44:11 PM UTCNoneAttached File-=>Added files.c.patch, #21160

    Back to the top

    Powered by Savane 3.1-cleanup1