diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-07-25 15:42:10 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-07-25 15:42:10 +0000 |
commit | c63913b36450081cd9da6f8e0c551d3de1592986 (patch) | |
tree | 16328b0c71a0ca528c06cef039de10398fb047be /libexec | |
parent | 69771d99ce9845d09ad7898fc200dd2e3553501a (diff) |
Check snprintf() rval for < 0; OK deraadt@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/telnetd/global.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libexec/telnetd/global.c b/libexec/telnetd/global.c index 63c2b57812d..d5dd39b556c 100644 --- a/libexec/telnetd/global.c +++ b/libexec/telnetd/global.c @@ -93,15 +93,14 @@ int output_data (const char *format, ...) { va_list args; - size_t remaining, ret; + size_t remaining; + int n; va_start(args, format); remaining = BUFSIZ - (nfrontp - netobuf); - ret = vsnprintf (nfrontp, - remaining, - format, - args); - nfrontp += ((ret < remaining - 1) ? ret : remaining - 1); + if ((n = vsnprintf(nfrontp, remaining, format, args)) >= remaining || n < 0) + n = strlen(nfrontp); + nfrontp += n; va_end(args); - return ret; + return n; } |