Commit 7920ed09 authored by Jozef Kralik's avatar Jozef Kralik

fix access to invalid memory when uri_path is not set

parent 2d95175b
Pipeline #1053 passed with stage
in 5 minutes and 38 seconds
...@@ -272,6 +272,8 @@ stop_processes(void) ...@@ -272,6 +272,8 @@ stop_processes(void)
oc_resource_t * oc_resource_t *
oc_ri_get_app_resource_by_uri(const char *uri, size_t uri_len, size_t device) oc_ri_get_app_resource_by_uri(const char *uri, size_t uri_len, size_t device)
{ {
if (!uri || uri_len == 0)
return NULL;
int skip = 0; int skip = 0;
if (uri[0] != '/') if (uri[0] != '/')
skip = 1; skip = 1;
...@@ -703,7 +705,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer, ...@@ -703,7 +705,7 @@ oc_ri_invoke_coap_entity_handler(void *request, void *response, uint8_t *buffer,
oc_interface_mask_t iface_query = 0, iface_mask = 0; oc_interface_mask_t iface_query = 0, iface_mask = 0;
/* Obtain request uri from the CoAP packet. */ /* Obtain request uri from the CoAP packet. */
const char *uri_path; const char *uri_path = NULL;
size_t uri_path_len = coap_get_header_uri_path(request, &uri_path); size_t uri_path_len = coap_get_header_uri_path(request, &uri_path);
/* Obtain query string from CoAP packet. */ /* Obtain query string from CoAP packet. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment