Opened 12 years ago

Closed 12 years ago

#5237 closed defect (invalid)

Make sure string allocation is big enough in MHOctetString::MHOctetString()

Reported by: Erik Hovland <erik@…> Owned by: Isaac Richards
Priority: trivial Milestone: unknown
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

In libmythfreemheg, in the file BaseClasses?.cpp the storage for a string is determined by calling strlen(). strlen() gives the size of the string without counting the null terminator. To make sure that there is room for the terminator we need to add one more to the string length.

Attachments (1)

libs_libmythfreemheg_BaseClasses.cpp-overrun-dynamic.patch (799 bytes) - added by Erik Hovland <erik@…> 12 years ago.
make sure the string buffer is big enough by adding a byte for the null termination

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by Erik Hovland <erik@…>

make sure the string buffer is big enough by adding a byte for the null termination

comment:1 Changed 12 years ago by danielk

Resolution: invalid
Status: newclosed

MHOctetString does not include the the null terminator from a char* string. The point of this class is to allow strings with nulls in them, so instead of a null terminator the length of the string is recorded in a separate int.

Note: See TracTickets for help on using tickets.