16:55 when you call strcat() to concatenate content with response line and headers, you get undefined behaviour due to having strings with no null-terminators as args to strcat
I'm kinda late but, when you take the size of a string literal, like sizeof("method"), you get the number of bytes necessary to hold the string, which is the number of characters + 1 for the null character at the end, whereas when you the size of any pointer, like sizeof(char *) or sizeof(int *) or any other pointer, you'll always get 8 because that's the size allocated for pointers, at least in 64-bit architectures.
16:55 when you call strcat() to concatenate content with response line and headers, you get undefined behaviour due to having strings with no null-terminators as args to strcat
isn't sizeof("method") the same thing as sizeof(char *) ?
I'm kinda late but, when you take the size of a string literal, like sizeof("method"), you get the number of bytes necessary to hold the string, which is the number of characters + 1 for the null character at the end, whereas when you the size of any pointer, like sizeof(char *) or sizeof(int *) or any other pointer, you'll always get 8 because that's the size allocated for pointers, at least in 64-bit architectures.
Thanks for the video!
strtok modifies the original buffer so gotta be careful.
3:25 share it if you know please.