summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-15 19:16:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-15 19:16:37 +0000
commitccac0a62dc56277bb1ace24af52f5380fb5c3a1f (patch)
treeda39aaedfef0edbe010c8a8959f3edddb71103e9
parentc124c0f1211a47776ab05fdaef9f1727e98cb23f (diff)
slight snprintf paranoia
-rw-r--r--libexec/rlogind/rlogind.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c
index 024b72dd6a6..2fd8f112020 100644
--- a/libexec/rlogind/rlogind.c
+++ b/libexec/rlogind/rlogind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rlogind.c,v 1.31 2002/01/07 03:44:30 millert Exp $ */
+/* $OpenBSD: rlogind.c,v 1.32 2002/02/15 19:16:36 deraadt Exp $ */
/*-
* Copyright (c) 1983, 1988, 1989, 1993
@@ -41,7 +41,7 @@ static char copyright[] =
#ifndef lint
/* from: static char sccsid[] = "@(#)rlogind.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$OpenBSD: rlogind.c,v 1.31 2002/01/07 03:44:30 millert Exp $";
+static char *rcsid = "$OpenBSD: rlogind.c,v 1.32 2002/02/15 19:16:36 deraadt Exp $";
#endif /* not lint */
/*
@@ -604,10 +604,12 @@ fatal(f, msg, syserr)
if (!confirmed)
*bp++ = '\01'; /* error indicator */
if (syserr)
- len = sprintf(bp, "rlogind: %s: %s.\r\n",
+ len = snprintf(bp, buf + sizeof buf - bp,
+ "rlogind: %s: %s.\r\n",
msg, strerror(errno));
else
- len = sprintf(bp, "rlogind: %s.\r\n", msg);
+ len = snprintf(bp, buf + sizeof buf - bp,
+ "rlogind: %s.\r\n", msg);
(void) write(f, buf, bp + len - buf);
exit(1);
}