bug fixed: must check the return value of vsnprintf
parent
906c9e81a6
commit
60b1f50c1f
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
Version 1.12 2014-12-05
|
||||||
|
* bug fixed: must check the return value of vsnprintf
|
||||||
|
|
||||||
Version 1.11 2014-11-20
|
Version 1.11 2014-11-20
|
||||||
* remove usleep call in logger.c
|
* remove usleep call in logger.c
|
||||||
* bug fixed: NOT set last_block->next when realloc
|
* bug fixed: NOT set last_block->next when realloc
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Name: libfastcommon
|
Name: libfastcommon
|
||||||
Version: 1.0.11
|
Version: 1.0.12
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: c common functions library extracted from my open source projects FastDFS
|
Summary: c common functions library extracted from my open source projects FastDFS
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
|
||||||
15
src/logger.c
15
src/logger.c
|
|
@ -800,6 +800,10 @@ void log_it_ex(LogContext *pContext, const int priority, const char *format, ...
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
len = vsnprintf(text, sizeof(text), format, ap);
|
len = vsnprintf(text, sizeof(text), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
if (len > sizeof(text))
|
||||||
|
{
|
||||||
|
len = sizeof(text);
|
||||||
|
}
|
||||||
|
|
||||||
switch(priority)
|
switch(priority)
|
||||||
{
|
{
|
||||||
|
|
@ -859,9 +863,13 @@ void log_it_ex(LogContext *pContext, const int priority, const char *format, ...
|
||||||
va_start(ap, format); \
|
va_start(ap, format); \
|
||||||
len = vsnprintf(text, sizeof(text), format, ap); \
|
len = vsnprintf(text, sizeof(text), format, ap); \
|
||||||
va_end(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, ...)
|
void logEmergEx(LogContext *pContext, const char *format, ...)
|
||||||
|
|
@ -914,7 +922,10 @@ void logAccess(LogContext *pContext, struct timeval *tvStart, \
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
len = vsnprintf(text, sizeof(text), format, ap);
|
len = vsnprintf(text, sizeof(text), format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
if (len > sizeof(text))
|
||||||
|
{
|
||||||
|
len = sizeof(text);
|
||||||
|
}
|
||||||
doLogEx(pContext, tvStart, NULL, text, len, false, true);
|
doLogEx(pContext, tvStart, NULL, text, len, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue