backend: fix xattr bookmark title check

Do not check if the bookmark title is a valid filename,
as we said in the user manual.

However, we should ensure that the string does not contain
NUL characters, since we assume that a valid bookmark storage
should not contain bookmarks with such names.
This commit is contained in:
CismonX 2025-01-26 19:35:03 +08:00
parent 996ca0e042
commit 3ed11f53e5
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
3 changed files with 6 additions and 6 deletions

View file

@ -1210,8 +1210,8 @@ Extended attributes:
The bookmark title.
Only available with @option{filename=guid}.
This value is allowed be set to any string that is valid UTF-8,
and does not have to be valid as a filename.
This value is allowed be set to any string that does not contain a
NUL character, and does not have to be valid as a filename.
@item guid
The bookmark GUID.
@ -1343,8 +1343,8 @@ Extended attributes:
The bookmark title.
Only available with @option{filename=guid}.
This value is allowed be set to any string that is valid UTF-8,
and does not have to be valid as a filename.
This value is allowed be set to any UTF-8 string that does not contain a
NUL character, and does not have to be valid as a filename.
@item guid
The bookmark GUID.

View file

@ -2663,7 +2663,7 @@ bookmark_set (
break;
case ATTR_KEY_TITLE:
if (0 != validate_filename(val, val_len, NULL)) {
if (NULL != memchr(val, '\0', val_len)) {
return -EINVAL;
}
nocheck = false;

View file

@ -3650,7 +3650,7 @@ bookmark_set (
break;
case ATTR_KEY_TITLE:
if (0 != validate_filename(val, val_len, NULL)) {
if (NULL != memchr(val, '\0', val_len)) {
return -EINVAL;
}
bm_cols.title = val;