aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bootparamd
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-02-06 14:25:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-02-06 14:25:49 +0000
commitd310bf3867b4168e57365196c3a31797c0538097 (patch)
treee48d05bb22f3cfdd1601b20152474ded34876afa /usr.sbin/bootparamd
parent8ea3ceda7644b7b93532d0c31b50ac5fa61e51a3 (diff)
downloadsrc-d310bf3867b4168e57365196c3a31797c0538097.tar.gz
src-d310bf3867b4168e57365196c3a31797c0538097.zip
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
Diffstat (limited to 'usr.sbin/bootparamd')
-rw-r--r--usr.sbin/bootparamd/bootparamd/bootparamd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.c b/usr.sbin/bootparamd/bootparamd/bootparamd.c
index be885de62f55..5bbd5b4becef 100644
--- a/usr.sbin/bootparamd/bootparamd/bootparamd.c
+++ b/usr.sbin/bootparamd/bootparamd/bootparamd.c
@@ -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];