iotivity-constrained icon indicating copy to clipboard operation
iotivity-constrained copied to clipboard

Bug in oc_core_res.c

Open river45 opened this issue 7 years ago • 0 comments

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

river45 avatar Aug 03 '18 01:08 river45