From ebdd192eb09a068bfa201677011aa747271e7cea Mon Sep 17 00:00:00 2001 From: wiz Date: Thu, 12 Sep 2013 07:28:28 +0000 Subject: Fix pkg_info -X segfault when last entry wasn't terminated with \n. Addresses PR 48207. --- pkgtools/pkg_install/files/lib/var.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgtools/pkg_install') diff --git a/pkgtools/pkg_install/files/lib/var.c b/pkgtools/pkg_install/files/lib/var.c index c212df0e9e7..9e9b65f4bba 100644 --- a/pkgtools/pkg_install/files/lib/var.c +++ b/pkgtools/pkg_install/files/lib/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.9 2013/05/17 07:27:29 martin Exp $ */ +/* $NetBSD: var.c,v 1.10 2013/09/12 07:28:28 wiz Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: var.c,v 1.9 2013/05/17 07:27:29 martin Exp $"); +__RCSID("$NetBSD: var.c,v 1.10 2013/09/12 07:28:28 wiz Exp $"); #if HAVE_SYS_STAT_H #include @@ -60,7 +60,7 @@ static const char *var_cmp(const char *, size_t, const char *, size_t); static void var_print(FILE *, const char *, const char *); /* - * Copy the specified varibales from the file fname to stdout. + * Copy the specified variables from the file fname to stdout. */ int var_copy_list(const char *buf, const char **variables) @@ -74,8 +74,8 @@ var_copy_list(const char *buf, const char **variables) next = eol + 1; len = eol - buf; } else { - next = eol; len = strlen(buf); + next = buf + len; } for (i=0; variables[i]; i++) { -- cgit v1.2.3