File geocode-glib-boo1169163.patch of Package geocode-glib.14739

From e7216583a219df9d9eba21a7fe1b74543b6d5851 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 14 Mar 2019 01:23:19 +0100
Subject: [PATCH] geocode-nominatim: Fix possible crash with missing place_rank

Spotted by Ordissimo <thierry@ordissimo.com>

Closes: #6
---
 geocode-glib/geocode-nominatim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/geocode-glib/geocode-nominatim.c b/geocode-glib/geocode-nominatim.c
index b2abc97..fc333dc 100644
--- a/geocode-glib/geocode-nominatim.c
+++ b/geocode-glib/geocode-nominatim.c
@@ -390,9 +390,11 @@ get_place_type_from_attributes (GHashTable *ht)
                 place_type =  GEOCODE_PLACE_TYPE_DRAINAGE;
         } else if (g_strcmp0 (category, "boundary") == 0) {
                 if (g_strcmp0 (type, "administrative") == 0) {
+                        const char *place_rank;
                         int rank;
 
-                        rank = atoi (g_hash_table_lookup (ht, "place_rank"));
+                        place_rank = g_hash_table_lookup (ht, "place_rank");
+                        rank = place_rank ? atoi (place_rank) : 0;
                         if (rank < 2)
                                 place_type =  GEOCODE_PLACE_TYPE_UNKNOWN;
 
-- 
2.26.0

openSUSE Build Service is sponsored by