summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshm <shm@NetBSD.org>2015-10-28 07:27:24 +0000
committershm <shm@NetBSD.org>2015-10-28 07:27:24 +0000
commit3dacdfcd6f1f4a4a39128aca4d82c8d4ec0bafff (patch)
tree727eb5f826f1959d757ee465f4d9522337086203
parent3a64143509c41250cc826e0b1cec1610ab1b820a (diff)
Fixed off-by-one in decode_ss (CID 977426)
OK kamil@
-rw-r--r--usr.bin/login/common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/login/common.c b/usr.bin/login/common.c
index 7ba9890b79d..a9ab4b8f555 100644
--- a/usr.bin/login/common.c
+++ b/usr.bin/login/common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.7 2015/10/27 14:53:00 shm Exp $ */
+/* $NetBSD: common.c,v 1.8 2015/10/28 07:27:24 shm Exp $ */
/*-
* Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: common.c,v 1.7 2015/10/27 14:53:00 shm Exp $");
+__RCSID("$NetBSD: common.c,v 1.8 2015/10/28 07:27:24 shm Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -390,7 +390,7 @@ decode_ss(const char *arg)
if (len > sizeof(*ssp) * 4 + 1 || len < sizeof(*ssp))
errx(EXIT_FAILURE, "Bad argument");
- if ((ssp = malloc(len)) == NULL)
+ if ((ssp = malloc(len + 1)) == NULL)
err(EXIT_FAILURE, NULL);
if (strunvis((char *)ssp, arg) != sizeof(*ssp))