Skip to content
Snippets Groups Projects
Commit b0570416 authored by Dean Camera's avatar Dean Camera
Browse files

Use strcat() in the HTTPServer project instead of using strcpy() and strlen().

parent 65644164
No related branches found
No related tags found
No related merge requests found
...@@ -218,7 +218,7 @@ static void HTTPServerApp_SendResponseHeader(void) ...@@ -218,7 +218,7 @@ static void HTTPServerApp_SendResponseHeader(void)
{ {
/* Copy over the HTTP 404 response header and send it to the receiving client */ /* Copy over the HTTP 404 response header and send it to the receiving client */
strcpy_P(AppData, HTTP404Header); strcpy_P(AppData, HTTP404Header);
strcpy(&AppData[strlen(AppData)], AppState->HTTPServer.FileName); strcat(AppData, AppState->HTTPServer.FileName);
uip_send(AppData, strlen(AppData)); uip_send(AppData, strlen(AppData));
AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing; AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
...@@ -236,7 +236,7 @@ static void HTTPServerApp_SendResponseHeader(void) ...@@ -236,7 +236,7 @@ static void HTTPServerApp_SendResponseHeader(void)
{ {
if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0) if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
{ {
strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType); strcat(AppData, MIMETypes[i].MIMEType);
FoundMIMEType = true; FoundMIMEType = true;
break; break;
} }
...@@ -247,11 +247,11 @@ static void HTTPServerApp_SendResponseHeader(void) ...@@ -247,11 +247,11 @@ static void HTTPServerApp_SendResponseHeader(void)
if (!(FoundMIMEType)) if (!(FoundMIMEType))
{ {
/* MIME type not found - copy over the default MIME type */ /* MIME type not found - copy over the default MIME type */
strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType); strcat_P(AppData, DefaultMIMEType);
} }
/* Add the end-of-line terminator and end-of-headers terminator after the MIME type */ /* Add the end-of-line terminator and end-of-headers terminator after the MIME type */
strcpy_P(&AppData[strlen(AppData)], PSTR("\r\n\r\n")); strcat_P(AppData, PSTR("\r\n\r\n"));
/* Send the MIME header to the receiving client */ /* Send the MIME header to the receiving client */
uip_send(AppData, strlen(AppData)); uip_send(AppData, strlen(AppData));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment