summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-09-28 16:12:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-09-28 16:12:14 +0000
commit7f85e105d9107f225988da3c1f31c59f619befac (patch)
treeee625ca7a832df38a540bfa0f915dbd8b009a3d5
parent3a77e1cc3dc4eb48eb5dfb3239150c768f108c6a (diff)
It is better style if path[] buffers are PATH_MAX, rather than
shorter. This subtly reduces the impact of truncation effects, as the truncation is less likely, and if it exists it may be detected directly by the system call with a proper error check. (this strange justification is sadly valid in a world where people moan oh so loudly about truncation but then don't audit and fix all instances) ok kettenis
-rw-r--r--usr.sbin/ldomd/ldomd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ldomd/ldomd.c b/usr.sbin/ldomd/ldomd.c
index 95efee1e9d9..6a94f302ce0 100644
--- a/usr.sbin/ldomd/ldomd.c
+++ b/usr.sbin/ldomd/ldomd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldomd.c,v 1.7 2016/08/28 00:51:48 guenther Exp $ */
+/* $OpenBSD: ldomd.c,v 1.8 2019/09/28 16:12:13 deraadt Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -192,7 +192,7 @@ main(int argc, char **argv)
TAILQ_FOREACH(guest, &guests, link) {
struct ds_conn *dc;
- char path[64];
+ char path[PATH_MAX];
if (strcmp(guest->name, "primary") == 0)
continue;
@@ -212,7 +212,7 @@ main(int argc, char **argv)
* to keep track of the file descriptors.
*/
for (i = 0; i < 256; i++) {
- char path[64];
+ char path[PATH_MAX];
snprintf(path, sizeof(path), "/dev/vdsp%d", i);
if (open(path, O_RDWR, 0) == -1)