From 3e355c9f79df20a4626747b2ff65aab420aacb89 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Fri, 29 Aug 2014 16:37:14 +0200 Subject: [PATCH] channels: fix possible overflow in logging Fixes clang compiler warning: "warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]" strncat requires an extra byte for '\0' so dest needs to have a size of n+1 --- include/freerdp/channels/log.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/freerdp/channels/log.h b/include/freerdp/channels/log.h index 8e8d6c330..f2125a68c 100644 --- a/include/freerdp/channels/log.h +++ b/include/freerdp/channels/log.h @@ -28,8 +28,8 @@ wLogMessage msg; \ wLog *log; \ \ - strncat(tag, "com.freerdp.channels.", sizeof(tag)); \ - strncat(tag, dbg_str, sizeof(tag) - sizeof("com.freerdp.channels.")); \ + strncat(tag, "com.freerdp.channels.", sizeof(tag) - 1); \ + strncat(tag, dbg_str, sizeof(tag) - 1 - sizeof("com.freerdp.channels.")); \ log = WLog_Get(tag); \ \ msg.Type = WLOG_MESSAGE_TEXT; \