summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2022-03-22 20:36:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2022-03-22 20:36:50 +0000
commit4eb22c6f90c5fe210b5cc765036d2f57e972ddee (patch)
tree54ec71fa7cc732b0b47179f5536b45cfa90988c8
parent3f6b52b1f3f99569c39dbdbe3e3e45d3484eaa33 (diff)
minor KNF cleanups during a re-read
-rw-r--r--usr.bin/doas/doas.c3
-rw-r--r--usr.bin/doas/parse.y4
2 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c
index f84e54f09e0..5fd9a2b7417 100644
--- a/usr.bin/doas/doas.c
+++ b/usr.bin/doas/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.96 2022/03/04 05:37:21 tb Exp $ */
+/* $OpenBSD: doas.c,v 1.97 2022/03/22 20:36:49 deraadt Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -212,6 +212,7 @@ authuser_checkpass(char *myname, char *login_style)
}
if (!challenge) {
char host[HOST_NAME_MAX + 1];
+
if (gethostname(host, sizeof(host)))
snprintf(host, sizeof(host), "?");
snprintf(cbuf, sizeof(cbuf),
diff --git a/usr.bin/doas/parse.y b/usr.bin/doas/parse.y
index 30d4c7d41c7..604becb5445 100644
--- a/usr.bin/doas/parse.y
+++ b/usr.bin/doas/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.30 2021/11/30 20:08:15 tobias Exp $ */
+/* $OpenBSD: parse.y,v 1.31 2022/03/22 20:36:49 deraadt Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -84,6 +84,7 @@ grammar: /* empty */
rule: action ident target cmd {
struct rule *r;
+
r = calloc(1, sizeof(*r));
if (!r)
errx(1, "can't allocate rule");
@@ -156,6 +157,7 @@ strlist: /* empty */ {
errx(1, "can't allocate strlist");
} | strlist TSTRING {
int nstr = arraylen($1.strlist);
+
if (!($$.strlist = reallocarray($1.strlist, nstr + 2,
sizeof(char *))))
errx(1, "can't allocate strlist");