Module Name:    src
Committed By:   christos
Date:           Wed Nov 25 18:46:59 UTC 2015

Modified Files:
        src/lib/libterminfo: tparm.c

Log Message:
We have the max length; use snprintf.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libterminfo/tparm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libterminfo/tparm.c
diff -u src/lib/libterminfo/tparm.c:1.15 src/lib/libterminfo/tparm.c:1.16
--- src/lib/libterminfo/tparm.c:1.15	Fri Jun  7 09:16:18 2013
+++ src/lib/libterminfo/tparm.c	Wed Nov 25 13:46:59 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tparm.c,v 1.15 2013/06/07 13:16:18 roy Exp $ */
+/* $NetBSD: tparm.c,v 1.16 2015/11/25 18:46:59 christos Exp $ */
 
 /*
  * Copyright (c) 2009, 2011, 2013 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tparm.c,v 1.15 2013/06/07 13:16:18 roy Exp $");
+__RCSID("$NetBSD: tparm.c,v 1.16 2015/11/25 18:46:59 christos Exp $");
 #include <sys/param.h>
 
 #include <assert.h>
@@ -130,7 +130,7 @@ onum(TERMINAL *term, const char *fmt, in
 		len = LONG_STR_MAX;
 	if (checkbuf(term, len + 2) == NULL)
 		return 0;
-	l = sprintf(term->_buf + term->_bufpos, fmt, num);
+	l = snprintf(term->_buf + term->_bufpos, len + 2, fmt, num);
 	term->_bufpos += l;
 	return l;
 }
@@ -342,7 +342,7 @@ _ti_tiparm(TERMINAL *term, const char *s
 					l = olen;
 				if (checkbuf(term, (size_t)(l + 1)) == NULL)
 					return NULL;
-				l = sprintf(term->_buf + term->_bufpos,
+				l = snprintf(term->_buf + term->_bufpos, l + 1,
 				    fmt, ostr);
 				term->_bufpos += l;
 			}

Reply via email to