From 64646a665c9fafc4454c67b6212702ed59e01c87 Mon Sep 17 00:00:00 2001 From: Lassi Marttala Date: Tue, 21 Feb 2012 12:16:23 +0100 Subject: GENDLT-15, Avoid buffer overrun with snprintf(). Check return value of dlt_user_log_write_start(_id) correctly. Reduce the number of applications if allocation fails. Make dlt_user_log_write_start inline Improve error checking in dlt_user_log_write_start_id Use databuffersize to avoid reallocations Signed-off-by: Christian Muck --- include/dlt/dlt_user_macros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/dlt/dlt_user_macros.h') diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h index 17a8ddb..1f95f3c 100755 --- a/include/dlt/dlt_user_macros.h +++ b/include/dlt/dlt_user_macros.h @@ -161,7 +161,7 @@ extern DltContext CONTEXT; #define DLT_LOG(CONTEXT,LOGLEVEL,ARGS...) \ { \ DltContextData log; \ - if (dlt_user_log_write_start(&CONTEXT,&log,LOGLEVEL)) \ + if (dlt_user_log_write_start(&CONTEXT,&log,LOGLEVEL)>0) \ { \ ARGS; \ dlt_user_log_write_finish(&log); \ @@ -185,7 +185,7 @@ extern DltContext CONTEXT; #define DLT_LOG_ID(CONTEXT,LOGLEVEL,MSGID,ARGS...) \ { \ DltContextData log; \ - if (dlt_user_log_write_start_id(&CONTEXT,&log,LOGLEVEL,MSGID)) \ + if (dlt_user_log_write_start_id(&CONTEXT,&log,LOGLEVEL,MSGID)>0) \ { \ ARGS; \ dlt_user_log_write_finish(&log); \ -- cgit v1.2.1