diff options
author | Nishant Chaprana <n.chaprana@samsung.com> | 2019-10-07 17:13:44 +0530 |
---|---|---|
committer | saerome.kim <saerome.kim@samsung.com> | 2019-10-08 09:54:53 +0900 |
commit | ef5fee61e9ab9877f7751c9a24b5c791ca978358 (patch) | |
tree | 0779b7f53cdebf86eec05c47aa5e056346e654dd | |
parent | 52bb88e991ffe1f696ac11abae10d23afa84482c (diff) | |
download | user-awareness-ef5fee61e9ab9877f7751c9a24b5c791ca978358.tar.gz user-awareness-ef5fee61e9ab9877f7751c9a24b5c791ca978358.tar.bz2 user-awareness-ef5fee61e9ab9877f7751c9a24b5c791ca978358.zip |
Fix GLib-CRITICAL using NULL check before g_strlcpy()
This patch removes below glib's critical warning:-
GLib-CRITICAL **: g_strlcpy: assertion 'src != NULL' failed
Below is the backtrace when glib warning is generated:-
(gdb) bt full
#0 0xb6176f14 in g_log () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#1 0xb61774f8 in g_return_if_fail_warning () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#2 0xb6191320 in g_strlcpy () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#3 0xb610ec90 in ua_user_add_device (
user_handle=user_handle@entry=0xb0c8ec50,
device_handle=device_handle@entry=0xb0e00a90,
callback=0x4064a1 <_ua_user_device_added_cb>,
user_data=user_data@entry=0x0)
at /usr/src/debug/capi-network-ua-0.11.2/src/user-awareness-users.c:835
__func__ = "ua_user_add_device"
ret = <optimized out>
handle = 0x0
temp_handle = 0x0
device = 0xb0e00a90
user = <optimized out>
uam_device = {operating_system = UAM_OS_TYPE_TIZEN,
type = UAM_TECH_TYPE_WIFI, mac = "ab:cd:ef:gh:ij:kl",
ipv4_addr = '\000' <repeats 49 times>,
device_id = '\000' <repeats 49 times>, payload = {
service_id = 0 '\000', device_icon = 0 '\000', purpose = 0 '\000',
duid = '\000' <repeats 17 times>,
bt_mac = '\000' <repeats 17 times>}, discriminant = 1,
last_seen = 0}
Change-Id: I25b7f26b18c6ff8bfff3522c653d66128f1eafd7
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
-rw-r--r-- | src/user-awareness-users.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/user-awareness-users.c b/src/user-awareness-users.c index 2194add..53d08a3 100644 --- a/src/user-awareness-users.c +++ b/src/user-awareness-users.c @@ -832,7 +832,8 @@ int ua_user_add_device(ua_user_h user_handle, ua_device_h device_handle, if (device->mac) g_strlcpy(uam_device.mac, device->mac, UAM_MAC_ADDRESS_STRING_LEN); - g_strlcpy(uam_device.device_id, device->device_id, UA_MOBILE_ID_STRING_LEN); + if (device->device_id) + g_strlcpy(uam_device.device_id, device->device_id, UA_MOBILE_ID_STRING_LEN); if (device->ipv4) g_strlcpy(uam_device.ipv4_addr, device->ipv4, UA_IPV4_ADDRESS_STRING_LEN); |