Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/xmlrpc/xmlrpc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ static int xmlrpc_getheader(FAR char *buffer, FAR char *header,
FAR char *temp;
int i = 0;

if (size <= 0)
{
return -1;
}

temp = strstr(buffer, header);
if (temp)
{
Expand All @@ -150,7 +155,7 @@ static int xmlrpc_getheader(FAR char *buffer, FAR char *header,

/* Copy the rest to the value parameter */

while ((*temp != ' ') && (*temp != '\n') && (i < size))
while ((*temp != ' ') && (*temp != '\n') && (i < size - 1))
{
value[i++] = *temp++;
}
Expand Down Expand Up @@ -213,7 +218,7 @@ static void xmlrpc_handler(int fd)
buffer[max] = 0;

ret = xmlrpc_getheader(buffer, "Content-Length:", value,
CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE);
sizeof(value));
if (ret > 0)
loadlen = atoi(value);
}
Expand Down
Loading