Fix gpn with invalid path in cwmp proto

This commit is contained in:
Vivek Kumar Dutta 2023-09-19 03:49:55 +00:00
parent 2eac512589
commit 5b409cb46a
2 changed files with 3 additions and 11 deletions

View file

@ -386,7 +386,6 @@ static int bbfdm_schema_handler(struct ubus_context *ctx, struct ubus_object *ob
LIST_HEAD(paths_list);
bbfdm_data_t data;
struct bbfdm_context *u;
size_t len;
u = container_of(ctx, struct bbfdm_context, ubus_ctx);
if (u == NULL) {
@ -407,11 +406,6 @@ static int bbfdm_schema_handler(struct ubus_context *ctx, struct ubus_object *ob
if (tb[DM_SCHEMA_PATH]) {
char *path = blobmsg_get_string(tb[DM_SCHEMA_PATH]);
len = strlen(path);
if (path[len-1] != '.') {
ERR("Invalid path %s", path);
return UBUS_STATUS_INVALID_ARGUMENT;
}
add_path_list(path, &paths_list);
}
@ -423,11 +417,6 @@ static int bbfdm_schema_handler(struct ubus_context *ctx, struct ubus_object *ob
blobmsg_for_each_attr(path, paths, rem) {
char *path_str = blobmsg_get_string(path);
len = strlen(path_str);
if (path_str[len-1] != '.') {
ERR("Invalid path %s", path);
return UBUS_STATUS_INVALID_ARGUMENT;
}
add_path_list(path_str, &paths_list);
}
}

View file

@ -1117,6 +1117,9 @@ bool valid_entry(bbfdm_data_t *data, struct blob_attr *input)
name = blobmsg_get_string(p);
list_for_each_entry(pn, data->plist, list) {
len = strlen(pn->path);
if (pn->path[len - 1] != '.') {
continue;
}
if (strncmp(pn->path, name, len) == 0) {
ret = true;
break;