Untitled
public text v1 · immutable[vl@home tmp]$ gcc -Wall -o test test.c && ./test
bar: bogus
[vl@home tmp]$ cat test.c
#include <stdio.h>
#include <string.h>
void dump(char **foo);
int main() {
char bar[16];
char *baz = bar;
dump(&baz);
printf("bar: %s\n", bar);
return 0;
}
void dump(char **foo) {
strncpy(*foo, "bogus", 6);
}
[vl@home tmp]$ gcc -Wall -o test test.c && ./test
bar: bogus