summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-11-27 01:02:49 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-11-27 01:02:49 +0000
commit25dce6b630b0f68ffcbbab79bea7f9ddff1d9738 (patch)
treedae12af87be46632c321aeba95674fddbdb5fa4e /libexec
parentfe2042e923435c4abad7f8326bb745f0f8862ac5 (diff)
Use strlcat() when adding to 'make_arg' via the -m flag to avoid
overflowing. Closes PR 2201.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rpc.yppasswdd/rpc.yppasswdd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libexec/rpc.yppasswdd/rpc.yppasswdd.c b/libexec/rpc.yppasswdd/rpc.yppasswdd.c
index dc3bde7ee58..4434b5e8271 100644
--- a/libexec/rpc.yppasswdd/rpc.yppasswdd.c
+++ b/libexec/rpc.yppasswdd/rpc.yppasswdd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc.yppasswdd.c,v 1.9 1997/08/19 07:00:51 niklas Exp $ */
+/* $OpenBSD: rpc.yppasswdd.c,v 1.10 2001/11/27 01:02:48 millert Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -32,7 +32,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: rpc.yppasswdd.c,v 1.9 1997/08/19 07:00:51 niklas Exp $";
+static char rcsid[] = "$OpenBSD: rpc.yppasswdd.c,v 1.10 2001/11/27 01:02:48 millert Exp $";
#endif
#include <sys/types.h>
@@ -90,8 +90,16 @@ main(argc, argv)
} else if (strcmp("-m", argv[i]) == 0) {
domake = 1;
while (i < argc) {
- strcat(make_arg, " ");
- strcat(make_arg, argv[i]);
+ if (strlcat(make_arg, " ",
+ sizeof(make_arg)) >=
+ sizeof(make_arg) ||
+ strlcat(make_arg, argv[i],
+ sizeof(make_arg)) >=
+ sizeof(make_arg)) {
+ (void) fprintf(stderr,
+ "-m argument too long.\n");
+ exit(1);
+ }
i++;
}
} else if (strcmp("-d", argv[i]) == 0