bugGNU nano - Bugs: bug #47289, segfault when the header command...

 
 

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

bug #47289: segfault when the header command string is quoteless

Submitter:  Benno Schulenberg <bens>
Submitted:  Sat 27 Feb 2016 07:54:41 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Sun 28 Feb 2016 12:04:33 PM UTC, comment #2: 

Fixed in SVN, r5691, with a tiny patch.

The rewriting of stuff will follow later.

Benno Schulenberg <bens>
Group administrator
Sat 27 Feb 2016 08:48:46 PM UTC, comment #1: 

Attached is a solution that makes the minimal needed changes to make header_exp() and parse_magic_exp() behave identically.  (To show that none of the logic of the latter was changed, most things were not renamed.)

This is still not the entirely correct solution, because it allows for junk to be present between regexes.  For example, this gets accepted and stores two regexes:

header "one" junk "two"

(file #36494)

Benno Schulenberg <bens>
Group administrator
Sat 27 Feb 2016 07:54:41 PM UTC, original submission:  

To reproduce, run src/nano after adding the following two lines at the end of your .nanorc file:

syntax "zero" "super$"
header ouch

Segmentation fault.

Bug is present since nano-2.3.3.
The offending commit is r4861.

Obvious parse_header_exp() and parse_magic_exp() should be completely analogous, but they are not.  The first one misses a check for (*ptr != '"') and one for && *ptr != '\0' and one for (*ptr == '\0').  The lack of the middle one is what makes it fall down.

Benno Schulenberg <bens>
Group administrator

 

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

Attached Files

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-20 bens Open/ClosedOpen Closed
    2016-02-28 bens StatusIn Progress Fixed
    2016-02-27 bens Attached File- Added generalize-regex-reading.patch, #36494
        Severity3 - Normal 4 - Important
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code