- add a few more safety's in the code to avoid memory issues

This commit is contained in:
Mark Vejvoda
2013-02-08 07:54:12 +00:00
parent e3c03b5916
commit 74d7841c4d
2 changed files with 16 additions and 6 deletions

View File

@@ -195,8 +195,7 @@ Mutex UPNP_Tools::mutexUPNP;
int nErrorID = 0 )
{
// Build basic error string
static char acErrorBuffer[256];
std::ostrstream outs(acErrorBuffer, (sizeof(acErrorBuffer) / sizeof(acErrorBuffer[0])));
static char acErrorBuffer[8096];
outs << pcMessagePrefix << ": ";
// Tack appropriate canned message onto end of supplied message
@@ -218,7 +217,7 @@ Mutex UPNP_Tools::mutexUPNP;
// Finish error message off and return it.
outs << std::ends;
acErrorBuffer[(sizeof(acErrorBuffer) / sizeof(acErrorBuffer[0])) - 1] = '\0';
acErrorBuffer[8095] = '\0';
return acErrorBuffer;
}