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  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Benno Schulenberg <bens>
Open/Closed: ClosedRelease: None

Add a New Comment (Rich MarkupRich 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 MemberIn 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:
<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.)

Attach File(s):
   
   
Comment:
   

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
      Open/ClosedOpen=>Closed
      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-cleanup