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

Submitter:  None
Submitted:  Sun 08 Nov 2015 07:03:44 PM UTC
   
 
Category:  Program Logic Severity:  3 - Normal
Priority:  * 5 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  None
Fixed Release:  None Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 06 Dec 2015 03:09:38 PM UTC, comment #1: 

Thanks for patch!

Pushed to screen-v4 and master.

Amadeusz Sławiński <amade>
Group administrator
Sun 08 Nov 2015 07:03:44 PM UTC, 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 Files:
   
   
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 (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amade (Posted a comment)
  •  

    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.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-06 amade Open/ClosedOpen Closed
    2015-11-08 None Attached File- Added screen-fix-oob.diff, #35419
        Attached File- Added screen-asan-error.10850, #35420

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code