summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-18 21:36:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-18 21:36:12 +0000
commit83d355686ebbe2351975d11e3c15dc7108da74b2 (patch)
tree3456f7e6b33fd950cbcae178a7805d5239839787
parent743e1ae11eebf2c741660a0d52106d208e50ef5c (diff)
handle vsnprintf returning -1
-rw-r--r--usr.bin/mg/buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index 9ffdc1cbcc4..a6879867e45 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.15 2001/05/24 03:05:20 mickey Exp $ */
+/* $OpenBSD: buffer.c,v 1.16 2001/08/18 21:36:11 deraadt Exp $ */
/*
* Buffer handling.
@@ -266,6 +266,10 @@ addlinef(BUFFER *bp, char *fmt, ...)
va_start(ap, fmt);
ntext = vsnprintf(dummy, 1, fmt, ap) + 1;
+ if (ntext == -1) {
+ va_end(ap);
+ return FALSE;
+ }
if ((lp = lalloc(ntext)) == NULL) {
va_end(ap);
return FALSE;