iotivity / iotivity-constrained

This mirror is deprecated. Please visit https://github.com/iotivity/iotivity-lite for forking the IoTivity-Lite project. To contribute code to the project, please visit https://www.iotivity.org/get-involved, https://www.iotivity.org/
https://iotivity.org/getting-started
Apache License 2.0
66 stars 42 forks source link

Bug in oc_core_res.c #22

Open river45 opened 6 years ago

river45 commented 6 years ago

Hi,

I think that I found a bug in the function oc_core_get_resource_by_uri() in api/oc_core_res.c on master branch.

oc_resource_t *
oc_core_get_resource_by_uri(const char *uri, int device)
{
  int skip = 0, type = 0;
  if (uri[0] != '/')
    skip = 1;
...
}

In the code above the variable skip would means a number of leading slash of the uri. So the code would be fixed like this.

oc_resource_t *
oc_core_get_resource_by_uri(const char *uri, int device)
{
  int skip = 0, type = 0;
  if (uri[0] == '/')
    skip = 1;
...
}

Thanks