The program below has a problem. Which statement correctly describes it?
#include <stdio.h>
#include <string.h>
int main(void) {
char path[8] = "/usr";
strcat(path, "/local");
printf("%s\n", path);
return 0;
}
strcat() trusts that the destination is big enough. "/usr/local" is 10 characters plus the terminator = 11 bytes, so 3 bytes land outside path. Use char path[16] or snprintf().