Module Name: src Committed By: mlelstv Date: Sun Apr 26 08:03:05 UTC 2015
Modified Files: src/libexec/utmp_update: utmp_update.c Log Message: size output buffer for strunvis to include the trailing NUL character. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/libexec/utmp_update/utmp_update.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/libexec/utmp_update/utmp_update.c diff -u src/libexec/utmp_update/utmp_update.c:1.11 src/libexec/utmp_update/utmp_update.c:1.12 --- src/libexec/utmp_update/utmp_update.c:1.11 Sat Sep 17 14:25:43 2011 +++ src/libexec/utmp_update/utmp_update.c Sun Apr 26 08:03:05 2015 @@ -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 @@ main(int argc, char *argv[]) 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))