Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 11 months ago

Closed 11 months ago

Last modified 10 months ago

#11570 closed Patch - Bug Fix (fixed)

Patch for zero length malloc in ParseBinary.cpp

Reported by: Gary Buhrmaster <gary.buhrmaster@…> Owned by: Gary Buhrmaster <gary.buhrmaster@…>
Priority: minor Milestone: 0.27
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Static analysis (scan-build) detected a feasible code path such that the string will have a length of zero when ParseString? is called. Malloc of a zero length has a implementation dependent result (i.e. possible invalid memory pointer). Add one to the requested length to eliminate the ambiguity. In addition, check the return from malloc to insure it was successful (should have been be a different static analysis detected error, but I did not see it in the reports).

https://github.com/garybuhrmaster/mythtv/commit/28a77c36e2d320fa1304ad3822d5359b05af07a0

Attachments (0)

Change History (2)

comment:1 Changed 11 months ago by Gary Buhrmaster <gary.buhrmaster@…>

  • Owner set to Gary Buhrmaster <gary.buhrmaster@…>
  • Resolution set to fixed
  • Status changed from new to closed

In b44f38e8487d521685521a8a50b12119d23e1cb8/mythtv:

Patch for zero length malloc and check for malloc success

There is a feasible code path such that the string will
have a length of zero. Malloc of a zero length has a
implementation dependent result (i.e. possible invalid
memory pointer). Add one to the requested length to
eliminate the abiguity. In addition, check the return
from malloc to insure it was successful.
(cherry picked from commit 28a77c36e2d320fa1304ad3822d5359b05af07a0)

Signed-off-by: Stuart Morgan <smorgan@…>

Fixes #11570

comment:2 Changed 10 months ago by paulh

  • Milestone changed from unknown to 0.27

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.