sprintf_s was not declared in this scope

前端 未结 6 1219
悲&欢浪女
悲&欢浪女 2021-01-01 10:28

I have a C program that uses sprintf_s. It works fine in Windows, but when I compile my code in Linux it gives this error:

sprintf_s was not dec         


        
6条回答
  •  一整个雨季
    2021-01-01 11:16

    snprintf is insecure, only sprintf_s is secure. snprintf does not guarantee to add a final \0, leading to possible subsequent overflows. look at https://github.com/rurban/safeclib for a proper implementation.

提交回复
热议问题