Skip to main content

C Cookbook

bannedaltreason
ctime_r, asctime_rstrftime,strbuf_addftimereentrant, but no check the buffer is long enough
gmtime,localtime,ctime,asctimereturn pointers to shared storage, not thread-safe
sprintf,vsprintfstrbuf,xstrfmt,xsnprintfbuffer overflow
strcpy,strcat,strbuf,xstrfmt,xsnprintf越界
strncpystrlcpy,strbuf,xstrfmt,xsnprintfNUL terminator
strncatquadratic behavior

定义宏移除方法

#define	assert(x) (void)0