On 14.09.2020 17:15, Rafał Miłecki wrote:
+static void uh_ubus_handle_post(struct client *cl)
+{
+       static const struct blobmsg_policy hdr_policy[__HDR_UBUS_MAX] = {
+               [HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
+       };
+       struct dispatch_ubus *du = &cl->dispatch.ubus;
+       struct blob_attr *tb[__HDR_UBUS_MAX];
+       const char *url = du->url_path;
+       const char *auth;
+
+       if (!strcmp(url, conf.ubus_prefix) ||
+           (url[strlen(url) - 1] == '/' && !strncmp(url, conf.ubus_prefix, 
strlen(url) - 1))) {

I think above may result in false positives for
ubus_prefix: /ubus/
url: /ub/

That should be:
if (ops->path_match(conf.ubus_prefix, url) && strlen(url) - 
strlen(conf.ubus_prefix) <= 1) {

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to