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

 
 

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

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sat 27 Feb 2016 07:54:41 PM UTC  
 
Severity: 4 - ImportantStatus: 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.

 

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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
    Mon 20 Jun 2016 09:44:09 AM UTCbensOpen/ClosedOpen=>Closed
    Sun 28 Feb 2016 12:04:33 PM UTCbensStatusIn Progress=>Fixed
    Sat 27 Feb 2016 08:48:46 PM UTCbensAttached File-=>Added generalize-regex-reading.patch, #36494
      Severity3 - Normal=>4 - Important
      StatusNone=>In Progress

    Back to the top


    Powered by Savane 3.1-cleanup1