From c50189d7ba570b0c797414484d69e23c5006ef27 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 9 Feb 1997 05:09:05 +0000 Subject: [PATCH] Buffer overflow from OpenBSD: Rev 1.3 millert: Fix potential buf oflow wrt strerror and sprintf. Obtained from: OpenBSD --- usr.sbin/rmt/rmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c index 79b4bbc8346e..9a60527b6f9a 100644 --- a/usr.sbin/rmt/rmt.c +++ b/usr.sbin/rmt/rmt.c @@ -244,6 +244,6 @@ error(num) { DEBUG2("rmtd: E %d (%s)\n", num, strerror(num)); - (void)sprintf(resp, "E%d\n%s\n", num, strerror(num)); + (void)snprintf(resp, sizeof(resp), "E%d\n%s\n", num, strerror(num)); (void)write(1, resp, strlen(resp)); }