Opened 13 years ago
Closed 13 years ago
Last modified 13 years ago
#11570 closed Patch - Bug Fix (fixed)
Patch for zero length malloc in ParseBinary.cpp
| Reported by: | Owned by: | ||
|---|---|---|---|
| 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

In b44f38e8487d521685521a8a50b12119d23e1cb8/mythtv: