From e02f9f682237b67a54d279e86421f63621944bd7 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 21 Apr 2005 00:19:55 +0000 Subject: bail out early, skip snprintf, if buflen is 0; ok cloder --- libexec/telnetd/global.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexec/telnetd/global.c b/libexec/telnetd/global.c index 841fbb5ae80..395102757f8 100644 --- a/libexec/telnetd/global.c +++ b/libexec/telnetd/global.c @@ -93,6 +93,8 @@ output_data (const char *format, ...) va_start(args, format); remaining = BUFSIZ - (nfrontp - netobuf); + if (remaining == 0) + return remaining; if ((n = vsnprintf(nfrontp, remaining, format, args)) >= remaining || n < 0) n = strlen(nfrontp); nfrontp += n; -- cgit v1.2.3