From: DoHyun Pyun Date: Thu, 24 Sep 2020 03:12:36 +0000 (+0900) Subject: Fix the valgrind issue X-Git-Tag: submit/tizen/20200924.060847^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f81bf0fb4ef616bab6d58709cc65c2a6ede1add8;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix the valgrind issue Invalid read of size 1 at 0x4B02F70: ____strtoul_l_internal (strtol_l.c:432) by 0x4B027F7: strtoul (strtol.c:106) by 0x489628F: ??? (in /usr/lib/libcapi-network-bluetooth.so.0.6.0) Change-Id: I074cacec908b65fd87e5376be16d96df528aa9f1 Signed-off-by: DoHyun Pyun --- diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c index d4c22e6..16e3fb5 100644 --- a/src/bluetooth-adapter.c +++ b/src/bluetooth-adapter.c @@ -1969,8 +1969,8 @@ static int __bt_convert_string_to_uuid(const char *string, } /* ptr[4] contain "08x" and "04hx" */ - ptr[5] = g_malloc0(sizeof(char) * 8); - ptr[6] = g_malloc0(sizeof(char) * 4); + ptr[5] = g_malloc0(sizeof(char) * 8 + 1); + ptr[6] = g_malloc0(sizeof(char) * 4 + 1); strncpy(ptr[5], ptr[4], 8); strncpy(ptr[6], ptr[4] + 8, 4);