Source-Changes-HG archive

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

[src/trunk]: src/libexec/utmp_update size output buffer for strunvis to inclu...



details:   https://anonhg.NetBSD.org/src/rev/bc6b608ec877
branches:  trunk
changeset: 337747:bc6b608ec877
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Apr 26 08:03:05 2015 +0000

description:
size output buffer for strunvis to include the trailing NUL character.

diffstat:

 libexec/utmp_update/utmp_update.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 6b7825156b7e -r bc6b608ec877 libexec/utmp_update/utmp_update.c
--- a/libexec/utmp_update/utmp_update.c Sun Apr 26 06:19:36 2015 +0000
+++ b/libexec/utmp_update/utmp_update.c Sun Apr 26 08:03:05 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utmp_update.c,v 1.11 2011/09/17 14:25:43 christos Exp $         */
+/*     $NetBSD: utmp_update.c,v 1.12 2015/04/26 08:03:05 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include <sys/cdefs.h>
 
-__RCSID("$NetBSD: utmp_update.c,v 1.11 2011/09/17 14:25:43 christos Exp $");
+__RCSID("$NetBSD: utmp_update.c,v 1.12 2015/04/26 08:03:05 mlelstv Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -99,8 +99,8 @@
        if (len > sizeof(*utx) * 4 + 1 || len < sizeof(*utx))
                logerr(0, "Bad argument size %zu", len);
 
-       if ((utx = malloc(len)) == NULL)
-               logerr(errno, "Can't allocate %zu", len);
+       if ((utx = malloc(len+1)) == NULL)
+               logerr(errno, "Can't allocate %zu", len+1);
 
        res = strunvis((char *)utx, argv[1]);
        if (res != (int)sizeof(*utx))



Home | Main Index | Thread Index | Old Index