Added stricter compile flags for debug build. Temporary solution since they will be added to all builds next.

Fixed strin formatting bugs in log_manager.cc .
This commit is contained in:
VilhoRaatikka 2014-03-27 17:51:23 +02:00
parent 9b1035751a
commit 7cc693b572
2 changed files with 6 additions and 5 deletions

View File

@ -674,7 +674,7 @@ static int logmanager_write_log(
if (use_valist) {
vsnprintf(wp+timestamp_len, safe_str_len, str, valist);
} else {
snprintf(wp+timestamp_len, safe_str_len, str);
snprintf(wp+timestamp_len, safe_str_len, "%s", str);
}
/** write to syslog */
@ -682,11 +682,11 @@ static int logmanager_write_log(
{
switch(id) {
case LOGFILE_ERROR:
syslog(LOG_ERR, wp+timestamp_len);
syslog(LOG_ERR, "%s", wp+timestamp_len);
break;
case LOGFILE_MESSAGE:
syslog(LOG_NOTICE, wp+timestamp_len);
syslog(LOG_NOTICE, "%s", wp+timestamp_len);
break;
default:
@ -742,7 +742,7 @@ static int logmanager_write_log(
* Copy original string from block buffer to
* other logs' block buffers.
*/
snprintf(wp_c, timestamp_len+str_len, wp);
snprintf(wp_c, timestamp_len+str_len, "%s", wp);
/** remove double line feed */
if (wp_c[timestamp_len-1+str_len-2] == '\n')

View File

@ -22,6 +22,7 @@ ifdef DYNLIB
LIB := libmysqld.so.18
endif
# -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC
CFLAGS := $(CFLAGS) -Wall
LDLIBS := $(LDLIBS) -pthread
@ -32,7 +33,7 @@ CPP_LDLIBS := -lstdc++
# Compiler flags, httpd arguments and debugger options
#
ifdef DEBUG
DEBUG_FLAGS := -DSS_DEBUG
DEBUG_FLAGS := -DSS_DEBUG -pipe -Wformat -Werror=format-security -fstack-protector --param=ssp-buffer-size=4 -fPIC
CFLAGS := $(CFLAGS) -ggdb -O0 -pthread $(DEBUG_FLAGS)
endif