mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
Fix too small hostname buffer in bootparamd
This fixes the following warning from clang 14:
usr.sbin/bootparamd/bootparamd/bootparamd.c:204:32: error: 'fscanf' may
overflow; destination buffer in argument 3 has size 255, but the
corresponding specifier may require size 256 [-Werror,-Wfortify-source]
The MAX_MACHINE_NAME macro indicates the maximum number of bytes in a
machine name, but it does not include the NUL terminator required for
scanf.
MFC after: 3 days
(cherry picked from commit d310bf3867
)
This commit is contained in:
parent
01cccd7048
commit
50cf1cf368
@ -34,7 +34,7 @@ extern const char *bootpfile;
|
||||
|
||||
static struct hostent *he;
|
||||
static char buffer[MAXLEN];
|
||||
static char hostname[MAX_MACHINE_NAME];
|
||||
static char hostname[MAX_MACHINE_NAME + 1];
|
||||
static char askname[MAX_MACHINE_NAME];
|
||||
static char path[MAX_PATH_LEN];
|
||||
static char domain_name[MAX_MACHINE_NAME];
|
||||
|
Loading…
Reference in New Issue
Block a user