Fix the length of string 22/33722/1
authorwu zheng <wu.zheng@intel.com>
Wed, 14 Jan 2015 07:13:47 +0000 (15:13 +0800)
committerwu zheng <wu.zheng@intel.com>
Wed, 14 Jan 2015 07:13:47 +0000 (15:13 +0800)
When string is char *, the length need to be set.

Change-Id: I8659442afe939af56ca0fe224cf145012197e8ba
Signed-off-by: Wu Zheng <wu.zheng@intel.com>
tools/hcitool.c

index ee810e5..da38052 100644 (file)
@@ -2444,11 +2444,11 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
                        char name_array[30];
                        char *name = name_array;
 
-                       memset(name, 0, sizeof(name));
+                       memset(name, 0, 30);
 
                        ba2str(&info->bdaddr, addr);
                        eir_parse_name(info->data, info->length,
-                                                       name, sizeof(name) - 1);
+                                                       name, 29);
 
                        printf("%s %s\n", addr, name);
                }