提交 60b1f50c 编写于 作者: Y yuqing

bug fixed: must check the return value of vsnprintf

上级 906c9e81
Version 1.12 2014-12-05
* bug fixed: must check the return value of vsnprintf
Version 1.11 2014-11-20
* remove usleep call in logger.c
* bug fixed: NOT set last_block->next when realloc
......
Name: libfastcommon
Version: 1.0.11
Version: 1.0.12
Release: 1%{?dist}
Summary: c common functions library extracted from my open source projects FastDFS
License: GPL
......
......@@ -800,6 +800,10 @@ void log_it_ex(LogContext *pContext, const int priority, const char *format, ...
va_start(ap, format);
len = vsnprintf(text, sizeof(text), format, ap);
va_end(ap);
if (len > sizeof(text))
{
len = sizeof(text);
}
switch(priority)
{
......@@ -859,9 +863,13 @@ void log_it_ex(LogContext *pContext, const int priority, const char *format, ...
va_start(ap, format); \
len = vsnprintf(text, sizeof(text), format, ap); \
va_end(ap); \
if (len > sizeof(text)) \
{ \
len = sizeof(text); \
} \
} \
\
log_it_ex2(pContext, caption, text, len, bNeedSync, true); \
log_it_ex2(pContext, caption, text, len, bNeedSync, true);
void logEmergEx(LogContext *pContext, const char *format, ...)
......@@ -914,7 +922,10 @@ void logAccess(LogContext *pContext, struct timeval *tvStart, \
va_start(ap, format);
len = vsnprintf(text, sizeof(text), format, ap);
va_end(ap);
if (len > sizeof(text))
{
len = sizeof(text);
}
doLogEx(pContext, tvStart, NULL, text, len, false, true);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册