functions returning char pointer

后端 未结 12 1299
醉梦人生
醉梦人生 2020-12-03 19:12

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

12条回答
  •  暖寄归人
    2020-12-03 19:53

    No..its still not safe.

    At the time you are doing strcpy(arr,f1());, the pointer used as the 2nd argument is already pointing to an array that does not exist.

提交回复
热议问题