Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libprop Fix lint



details:   https://anonhg.NetBSD.org/src/rev/a107b32b9eee
branches:  trunk
changeset: 973100:a107b32b9eee
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 20 00:16:50 2020 +0000

description:
Fix lint

diffstat:

 common/lib/libprop/prop_string.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 9b5d88455d3c -r a107b32b9eee common/lib/libprop/prop_string.c
--- a/common/lib/libprop/prop_string.c  Fri Jun 19 21:17:48 2020 +0000
+++ b/common/lib/libprop/prop_string.c  Sat Jun 20 00:16:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prop_string.c,v 1.14 2020/06/06 21:25:59 thorpej Exp $ */
+/*     $NetBSD: prop_string.c,v 1.15 2020/06/20 00:16:50 christos Exp $        */
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -314,6 +314,7 @@
        prop_string_t ps;
        char *str = NULL;
        int len;
+       size_t nlen;
        va_list ap;
 
        _PROP_ASSERT(fmt != NULL);
@@ -324,16 +325,17 @@
 
        if (len < 0)
                return (NULL);
+       nlen = len + 1;
 
-       str = _PROP_MALLOC(len + 1, M_PROP_STRING);
+       str = _PROP_MALLOC(nlen, M_PROP_STRING);
        if (str == NULL)
                return (NULL);
 
        va_start(ap, fmt);
-       vsnprintf(str, len + 1, fmt, ap);
+       vsnprintf(str, nlen, fmt, ap);
        va_end(ap);
 
-       ps = _prop_string_instantiate(0, str, len);
+       ps = _prop_string_instantiate(0, str, (size_t)len);
        if (ps == NULL)
                _PROP_FREE(str, M_PROP_STRING);
 



Home | Main Index | Thread Index | Old Index