bugGNU Screen - Bugs: bug #46401, Global out of bounds read in...

 
 

bug #46401: Global out of bounds read in termcap.c due to wrong loop

Submitted by:  None
Submitted on:  Sun Nov 8 19:03:44 2015  
 
Category: Program LogicSeverity: 3 - Normal
Priority: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: ClosedRelease: None
Fixed Release: NonePlanned Release: None
Work Required: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun Dec 6 15:09:38 2015, comment #1:

Thanks for patch!

Pushed to screen-v4 and master.

Amadeusz Sławiński <amade>
Project Administrator
Sun Nov 8 19:03:44 2015, original submission:

I tested screen with the compiler feature Address Sanitizer (-fsanitize=address in CFLAGS/LDFLAGS). When running screen on a real Linux console (not in an X terminal) it didn't start due to an error.

The error can't be seen directly because screen disables stderr, to reproduce it one can use ASAN_OPTIONS="log_path=[somepath]".

The problem is this code in termcap.c:
s = "l+m+k+j+u+t+v+w+q-x|n+o~s_p\"r#`+a:f'g#~o.v-^+<,>h#I#0#y<z>";
for (i = strlen(s) & ~1; i >= 0; i -= 2)
D_c0_tab[(int)(unsigned char)s[i]] = s[i + 1];

The loop will start right of the string s. One needs to substract 2 from strlen(s) for the code to be correct. Right after that is a loop with the same logic, so the same fix should be applied. I will attached a patch that fixes both.

Will also attach the address sanitizer error message.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #35419:  screen-fix-oob.diff added by None (616B - text/x-patch)
file #35420:  screen-asan-error.10850 added by None (2kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by amade (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Dec 6 15:09:38 2015amadeOpen/ClosedOpen=>Closed
    Sun Nov 8 19:03:44 2015NoneAttached File-=>Added screen-fix-oob.diff, #35419
      Attached File-=>Added screen-asan-error.10850, #35420

    Back to the top


    Powered by Savane 3.1-cleanup1