tnc-ifmap: Null-terminate buffer to make sscanf()-calls safe
This commit is contained in:
@@ -80,7 +80,7 @@ METHOD(tnc_ifmap_soap_msg_t, post, bool,
|
|||||||
xmlChar *xml_str, *errorCode, *errorString;
|
xmlChar *xml_str, *errorCode, *errorString;
|
||||||
int xml_len, len, written;
|
int xml_len, len, written;
|
||||||
chunk_t xml, http;
|
chunk_t xml, http;
|
||||||
char buf[4096];
|
char buf[4096] = { 0 };
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
DBG2(DBG_TNC, "sending ifmap %s", request->name);
|
DBG2(DBG_TNC, "sending ifmap %s", request->name);
|
||||||
@@ -131,7 +131,8 @@ METHOD(tnc_ifmap_soap_msg_t, post, bool,
|
|||||||
xml = chunk_empty;
|
xml = chunk_empty;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
len = this->tls->read(this->tls, buf, sizeof(buf), TRUE);
|
/* reduce size so the buffer is null-terminated */
|
||||||
|
len = this->tls->read(this->tls, buf, sizeof(buf)-1, TRUE);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user