FAT: Limit volume names to 11 characters, not 10.
The rest of the code does a memcpy(..., ..., min(11, strlen(...)) so clearly no NULL terminator is needed and 11 is the real limit. Should fix #18074. Change-Id: I6aea166899eab2bab9511ca52981ccc9172b6c17 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5823 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
5728bdf606
commit
0843085384
@@ -41,10 +41,12 @@ create_volume_label_sector(void *sector, const char *label)
|
||||
status_t
|
||||
check_volume_name(const char* name)
|
||||
{
|
||||
if (name == NULL || strlen(name) >= 11
|
||||
|| strchr(name, '/') != NULL) {
|
||||
if (name == NULL)
|
||||
return B_BAD_VALUE;
|
||||
if (strlen(name) > 11)
|
||||
return B_NAME_TOO_LONG;
|
||||
if (strchr(name, '/') != NULL)
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user