Fix: src.ctf.fs: metadata-info: sanitize `path` param
[deliverable/babeltrace.git] / plugins / ctf / fs-src / query.c
index 0235cf6bccf40a983d29b06bf62b79186c9f670a..c185307caa3f6b2ef8d1dcd90b0704ec81876117 100644 (file)
@@ -77,6 +77,18 @@ bt_query_status metadata_info_query(
        }
 
        path_value = bt_value_map_borrow_entry_value_const(params, "path");
+       if (!path_value) {
+               BT_LOGE_STR("Mandatory `path` parameter missing");
+               status = BT_QUERY_STATUS_INVALID_PARAMS;
+               goto error;
+       }
+
+       if (!bt_value_is_string(path_value)) {
+               BT_LOGE_STR("`path` parameter is required to be a string value");
+               status = BT_QUERY_STATUS_INVALID_PARAMS;
+               goto error;
+       }
+
        path = bt_value_string_get(path_value);
 
        BT_ASSERT(path);
This page took 0.025017 seconds and 5 git commands to generate.