bhyve/snapshot: limit snapshot filename to NAME_MAX
NAME_MAX is a better fit since strcat_extension() constructs the filename of the snapshot file. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D34291
This commit is contained in:
parent
3efc45f34e
commit
961e6a12ef
@ -181,10 +181,10 @@ strcat_extension(const char *base_str, const char *ext)
|
||||
char *res;
|
||||
size_t base_len, ext_len;
|
||||
|
||||
base_len = strnlen(base_str, MAX_VMNAME);
|
||||
ext_len = strnlen(ext, MAX_VMNAME);
|
||||
base_len = strnlen(base_str, NAME_MAX);
|
||||
ext_len = strnlen(ext, NAME_MAX);
|
||||
|
||||
if (base_len + ext_len > MAX_VMNAME) {
|
||||
if (base_len + ext_len > NAME_MAX) {
|
||||
fprintf(stderr, "Filename exceeds maximum length.\n");
|
||||
return (NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user