From 7f85e105d9107f225988da3c1f31c59f619befac Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 28 Sep 2019 16:12:14 +0000 Subject: 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 --- usr.sbin/ldomd/ldomd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin/ldomd/ldomd.c') 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) -- cgit v1.2.3