在Linux的内核的c的sprintf [英] C sprintf in Linux Kernel
本文介绍了在Linux的内核的c的sprintf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
时有功能类似在Linux内核(sprintf的()
如的printf()
- > 的printk()
)?
Is there function like sprintf()
in Linux Kernel (like printf()
->printk()
)?
推荐答案
是的。
<一href=\"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/lib/vsprintf.c#n1828\">https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/lib/vsprintf.c#n1828
int snprintf(char *buf, size_t size, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = vsnprintf(buf, size, fmt, args);
va_end(args);
return i;
}
EXPORT_SYMBOL(snprintf);
的sprintf()
本身很容易出现缓冲区溢出。 CERT缓冲区溢出中,<一个href=\"https://developer.apple.com/library/mac/documentation/security/conceptual/securecodingguide/Articles/BufferOverflows.html\">Apple,等等
sprintf()
by itself is prone to buffer overflows. CERT buffer overflows, Apple, etc
这篇关于在Linux的内核的c的sprintf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文