]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_geolocation: Ensure required 'location_info' is present.
authorSean Bright <sean@seanbright.com>
Fri, 7 Jul 2023 14:11:44 +0000 (10:11 -0400)
committerasterisk-org-access-app[bot] <120671045+asterisk-org-access-app[bot]@users.noreply.github.com>
Wed, 12 Jul 2023 17:39:11 +0000 (17:39 +0000)
Fixes #189

res/res_geolocation/geoloc_config.c

index 26dd2d9fd1205c9a467e1f85b9ec2c442070e990..88857c4957c1ea4fc7dc3d6b3429ddf5d6253c64 100644 (file)
@@ -168,6 +168,12 @@ static int geoloc_location_apply_handler(const struct ast_sorcery *sorcery, void
        enum ast_geoloc_validate_result result;
        int rc = 0;
 
+       if (!location->location_info) {
+               ast_log(LOG_ERROR, "Location '%s' is missing required element 'location_info'",
+                       location_id);
+               return -1;
+       }
+
        result = validate_location_info(location_id, location->format, location->location_info);
        if (result != AST_GEOLOC_VALIDATE_SUCCESS) {
                return -1;