Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libterminfo We have the max length; use snprintf.



details:   https://anonhg.NetBSD.org/src/rev/b4995d1ae0d2
branches:  trunk
changeset: 811988:b4995d1ae0d2
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 25 18:46:59 2015 +0000

description:
We have the max length; use snprintf.

diffstat:

 lib/libterminfo/tparm.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r eadc0333a51f -r b4995d1ae0d2 lib/libterminfo/tparm.c
--- a/lib/libterminfo/tparm.c   Wed Nov 25 18:46:24 2015 +0000
+++ b/lib/libterminfo/tparm.c   Wed Nov 25 18:46:59 2015 +0000
@@ -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 @@
                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 @@
                                        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;
                        }



Home | Main Index | Thread Index | Old Index