Ticket #5237: libs_libmythfreemheg_BaseClasses.cpp-overrun-dynamic.patch

File libs_libmythfreemheg_BaseClasses.cpp-overrun-dynamic.patch, 799 bytes (added by Erik Hovland <erik@…>, 16 years ago)

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

  • libs/libmythfreemheg/BaseClasses.cpp

    If MHOctetString::MHOctetString allocates the string it
    
    From: Erik Hovland <erik@hovland.org>
    
    will be one char too short because strlen returns the length
    of the given string w/o the null terminator.
    ---
    
     libs/libmythfreemheg/BaseClasses.cpp |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)
    
    diff --git a/libs/libmythfreemheg/BaseClasses.cpp b/libs/libmythfreemheg/BaseClasses.cpp
    index ddcb43b..84b96e2 100644
    a b MHOctetString::MHOctetString() 
    4040// Construct from a string
    4141MHOctetString::MHOctetString(const char *str, int nLen)
    4242{
    43     if (nLen < 0) nLen = strlen(str);
     43    if (nLen < 0) nLen = strlen(str) + 1;
    4444    m_nLength = nLen;
    4545    if (nLen == 0) m_pChars = 0;
    4646    else {