bugGNU nano - Bugs: bug #61064, when prepending, nano would crash...

 
 

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

bug #61064: when prepending, nano would crash if fdopen() were to fail

Submitter:  Benno Schulenberg <bens>
Submitted:  Fri 20 Aug 2021 07:45:14 AM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 20 Aug 2021 08:38:21 AM UTC, comment #1: 

Fixed in git, commit eaff5ec9, by checking that 'stream' is not NULL in safe_tempfile().

Benno Schulenberg <bens>
Group administrator
Fri 20 Aug 2021 07:45:14 AM UTC, original submission:  

To reproduce, replace the line '*stream = fdopen(fd, "r+b");' in src/files.c with '*stream = NULL;' -- to simulate a failure of fdopen().  Compile and then run 'src/nano README'.
Then type: ^O ^K NEWS M-P <Enter>.
Result: nano crashes.

Bug was found by code inspection while working on bug #61056 -- by seeing that safe_tempfile() does not check the result of fdopen() and will happily return a filename even when 'stream' is NULL, and that the callers of safe_tempfile() do not check 'stream' either.

Bug has existed for sixteen years, since version 1.3.8, commit 5e068c60.

Benno Schulenberg <bens>
Group administrator

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Submitted the item)
  •  

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-07 bens Open/ClosedOpen Closed
    2021-08-23 bens Summarywhen prepending, nano would crash if fdopen() would fail when prepending, nano would crash if fdopen() were to fail
    2021-08-20 bens StatusIn Progress Fixed
        Summarywhen the user prepends, nano would crash if fdopen() would fail when prepending, nano would crash if fdopen() would fail

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code