Fix derefrencing of NULL pointer 17/247517/2
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 11 Nov 2020 11:00:54 +0000 (20:00 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 11 Nov 2020 11:16:43 +0000 (20:16 +0900)
In some cases network->device could be NULL which leads to crash

Change-Id: I3cc5401b37fd48d8d702935bef7afa7e277222f2
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
packaging/connman.spec
src/service.c

index 072e8bf..33b9ccf 100644 (file)
@@ -5,7 +5,7 @@
 
 Name:           connman
 Version:        1.37
-Release:        49
+Release:        50
 License:        GPL-2.0+
 Summary:        Connection Manager
 Url:            http://connman.net
index f77c8a5..dd4f191 100755 (executable)
@@ -7657,6 +7657,9 @@ static int calculate_score_last_user_selection(struct connman_service *service)
        struct tm* ref_timeinfo;
 
        device = connman_network_get_device(service->network);
+       if (!device)
+               return 0;
+
        last_user_selection_time = connman_device_get_last_user_selection_time(device);
        last_user_selection_ident = connman_device_get_last_user_selection_ident(device);
        frequency = connman_network_get_frequency(service->network);