I came across lot of functions returning char pointers in one legacy application. Some of them returning pointers to local character arrays. It seems to be causing crashes a
The f1 function is returning a temporary (buff) which is freed when the function returns. You need to use malloc() inside the function.