From 5e6cfbf3a7a005c31725f4a7d9e701856a7cb846 Mon Sep 17 00:00:00 2001 From: tjr Date: Fri, 1 Nov 2002 12:48:28 +0000 Subject: [PATCH] Another buffer overflow similar to the recent one in mkstr(1). --- usr.bin/xstr/xstr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/xstr/xstr.c b/usr.bin/xstr/xstr.c index 2ffbc72f632..6195ff2b353 100644 --- a/usr.bin/xstr/xstr.c +++ b/usr.bin/xstr/xstr.c @@ -231,6 +231,8 @@ yankstr(char **cpp) static char tmp[] = "b\bt\tr\rn\nf\f\\\\\"\""; while ((c = *cp++)) { + if (dp == dbuf + sizeof(dbuf) - 3) + errx(1, "message too long"); switch (c) { case '"': -- 2.45.0