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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #30671: nano segfaults when interactively providing filenames

Submitter:  None
Submitted:  Fri 06 Aug 2010 03:44:11 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

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

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

Benno Schulenberg <bens>
Group administrator
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:
<code>
    if (openfile->current_stat == NULL && !tmp && realexists)
    stat(realname, openfile->current_stat);
</code>

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:
<code>
    if (openfile->current_stat == NULL && !tmp && realexists) {
openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
stat(realname, openfile->current_stat);
}
</code>
just like on lines 153 and 1874.

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

Anonymous

 

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

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
  • -email is unavailable- added by bens (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-22 bens StatusNone Fixed
        Assigned toNone bens
        Open/ClosedOpen Closed
        Summary[BUG] nano segfaults when interactively providing filenames nano segfaults when interactively providing filenames
    2010-08-06 None Attached File- Added files.c.patch, #21160

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code