We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vsnprintf用法貌似不对
#include <stdio.h> #include <stdarg.h> int vsnprintf(char *str, size_t size, const char *format, va_list ap);
hlog.c下面这段代码没有考虑第二种长度超出size的情况,造成len+=..后len值错误
case 's': { va_list ap; va_start(ap, fmt); len += vsnprintf(buf + len, bufsize - len, fmt, ap); va_end(ap); }
The text was updated successfully, but these errors were encountered:
这并不是这一处vsnprintf用法问题,还有其他地方也存在可能因超出bufSize导致崩溃,根本问题在于hlog并不是防御性编码风格主动做了参数检查防止超出bufSize,这样的函数属于契约式编码,要求打印log时调用者必须确保绝不超过bufSize,默认bufSize=16k,可通过logger_set_max_bufsize调整。
Sorry, something went wrong.
No branches or pull requests
vsnprintf用法貌似不对
hlog.c下面这段代码没有考虑第二种长度超出size的情况,造成len+=..后len值错误
The text was updated successfully, but these errors were encountered: