Resolves the build error for strncpy 94/220994/4 accepted/tizen/unified/20200101.120621 submit/tizen/20191230.003618
authorAmit Purwar <amit.purwar@samsung.com>
Thu, 26 Dec 2019 06:58:12 +0000 (12:28 +0530)
committerAmit Purwar <amit.purwar@samsung.com>
Fri, 27 Dec 2019 09:12:42 +0000 (14:42 +0530)
Change-Id: I3ccd06ce99ce14cfa6a583c73bde66b533054085
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
bt-oal/common/oal-utils.c
bt-oal/common/oal-utils.h

index 65a7e8e..76861f1 100755 (executable)
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <bluetooth.h>
 #include "oal-utils.h"
+#include "oal-manager.h"
 
 char *bdt_bd2str(const bt_address_t *bdaddr, bdstr_t *bdstr)
 {
@@ -40,15 +41,16 @@ char *bdt_bd2str(const bt_address_t *bdaddr, bdstr_t *bdstr)
        return *bdstr;
 }
 
-char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf)
+char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf, int len)
 {
        const uint8_t *p;
 
        if (!bd_addr)
-               return strncpy(buf, "NULL", sizeof("NULL"));
+               return strncpy(buf, "NULL", len);
+
        p = bd_addr->address;
 
-       snprintf(buf, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
+       snprintf(buf, len, "%02x:%02x:%02x:%02x:%02x:%02x",
                        p[0], p[1], p[2], p[3], p[4], p[5]);
 
        return buf;
@@ -56,8 +58,8 @@ char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf)
 
 char *bdaddr_2_str(const bt_bdaddr_t *bd_addr)
 {
-       static char buf[18];
-       return convert_bdaddr_2_str(bd_addr, buf);
+       static char buf[BT_ADDRESS_STR_LEN];
+       return convert_bdaddr_2_str(bd_addr, buf, BT_ADDRESS_STR_LEN);
 }
 
 void string_to_uuid(char *str, service_uuid_t *p_uuid)
index 7c3a782..1e8295f 100755 (executable)
@@ -438,7 +438,7 @@ char* convert_bt_property_2_str(const bt_property_t *property);
 char* convert_property_type_2_str(bt_property_type_t prop_type);
 char* convert_scan_mode_2_str(bt_scan_mode_t scan_mode);
 char* convert_device_type_2_str(bt_device_type_t device_type);
-char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf);
+char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf, int len);
 
 void local_le_feat_2_string(char *str, const bt_local_le_features_t *f);
 const char *dump_uuid_name(int uuid_no);