diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 2002-07-26 20:03:46 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 2002-07-26 20:03:46 +0000 |
commit | 0ef22c4a63ab7cb498523bb818ba746062a1417f (patch) | |
tree | e6b8984e094fa46d6e34464bceba7ebd326d8bab /games | |
parent | 54c85aab8618e4a3c7ec33e8505fe1eb2dea250a (diff) |
Theo pointed out a vsnprintf() whose return value was being used
inappropriately.
Diffstat (limited to 'games')
-rw-r--r-- | games/hunt/huntd/terminal.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/games/hunt/huntd/terminal.c b/games/hunt/huntd/terminal.c index 8b7780a9ff1..05a5775bfc0 100644 --- a/games/hunt/huntd/terminal.c +++ b/games/hunt/huntd/terminal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: terminal.c,v 1.4 1999/02/01 06:53:56 d Exp $ */ +/* $OpenBSD: terminal.c,v 1.5 2002/07/26 20:03:45 pjanzen Exp $ */ /* $NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $ */ /* * Hunt @@ -111,11 +111,14 @@ outyx(pp, y, x, fmt) int len; va_start(ap, fmt); - len = vsnprintf(buf, sizeof buf, fmt, ap); + len = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + if (len >= (int)sizeof(buf)) + len = sizeof(buf) - 1; if (y >= 0 && x >= 0) cgoto(pp, y, x); - outstr(pp, buf, len); - va_end(ap); + if (len > 0) + outstr(pp, buf, len); } /* |