Help!! I'm currently struggling with Parse with check50 reporting three errors as follows:
Here is the sandbox report
And here is my parse code..
bool parse(const char* line, char* abs_path, char* query)
{
char req_line[strlen(line) + 1];
strcpy(req_line, line);
int i = 0;
char* method = strtok(req_line, " ");
char* req_tar = strtok(NULL, " ");
char* version = strtok(NULL, "\r\n\r\n");
abs_path = strtok(req_tar, "?");
if(strcmp(req_tar, abs_path) != 0)
query = strstr(req_tar, abs_path);
if(query[i] == '?' && strlen(query) == 1)
query[0] = '\0';
if(strcmp(method, "GET") != 0)
{
error(405);
return false;
}
if(req_tar[0] != '/')
{
error(501);
return false;
}
if(req_tar[i] == '"')
{
error(400);
return false;
}
if(strcmp(version, "HTTP/1.1") != 0)
{
error(505);
return false;
}
else
return true;
}
Could someone please give me a hint where the problem lies?
Thanks in advance.