The code assumes that the provided pattern is at least one byte long.
reject shorter patterns.
Empty messages could lead to heap corruptions and ubusd_acl_check()
bypass.
Reported-by: Karsten Sperling <[email protected]>
Fixes: 12623b43060a ("trim the wildcard of partial patterns to keep the avl tree sorted properly")
Signed-off-by: Hauke Mehrtens <[email protected]>
pattern = blobmsg_data(attr[EVREG_PATTERN]);
len = strlen(pattern);
+ if (len <= 0)
+ return UBUS_STATUS_PERMISSION_DENIED;
+
if (pattern[len - 1] == '*') {
partial = true;
pattern[len - 1] = 0;