From 3bc1acc1398517bd8075fd9b3a6db37ebfab155c Mon Sep 17 00:00:00 2001 From: sinikang Date: Fri, 21 Jul 2017 08:09:59 +0900 Subject: [PATCH] Fix buffer overflow issue In case of using strncat() function, should check the avaliable length of dest buffer Change-Id: I8bb9d590802e8838a09fad90304906bbcee6adbb --- packaging/libtcore.spec | 2 +- src/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/libtcore.spec b/packaging/libtcore.spec index c51af18..7f8209b 100644 --- a/packaging/libtcore.spec +++ b/packaging/libtcore.spec @@ -1,6 +1,6 @@ %define major 0 %define minor 3 -%define patchlevel 18 +%define patchlevel 19 Name: libtcore Version: %{major}.%{minor}.%{patchlevel} diff --git a/src/util.c b/src/util.c index fbc17b8..dc83798 100644 --- a/src/util.c +++ b/src/util.c @@ -1568,7 +1568,7 @@ void tcore_util_hex_dump(const char *pad, int size, const void *data) memset(buf, 0, 255); snprintf(buf, 255, "%s%04X: ", pad, i + 1); } else - strncat(buf, TAB_SPACE, strlen(TAB_SPACE)); + strncat(buf, TAB_SPACE, sizeof(buf) - strnlen(buf, sizeof(buf)) - 1); } } -- 2.7.4