When I add the below two blocks I get a segfault when I submit a request from telnet. Actually, I can add just the first and things run fine but upon the second (or even moving the first up above other code) gives the segfault. I assume it has to do with assigning something too large to an array but I can't find it.
// TODO: extract query from request-target
// Extract request-target
char requestTarget[] = "";
int rtLength = strrchr(line, ' ') - strchr(line, ' ');
strncpy(requestTarget, strchr(line, ' ') + sizeof(char), rtLength);
requestTarget[rtLength] = '\0';
printf("This is the request-target: %s\n", requestTarget);
printf("This is the size of rquestTarget: %d\n", strlen(requestTarget));
// Extract query from line
char query[] = "";
int qLength = strrchr(line, ' ') - strchr(line, '?');
strncpy(query, strchr(line, '?') + sizeof(char), qLength);
query[qLength] = '\0';
printf("This is the query: %s\n", query);
printf("This is the size of query: %d\n", strlen(query));