diff options
author | martin <martin> | 2013-05-17 07:27:29 +0000 |
---|---|---|
committer | martin <martin> | 2013-05-17 07:27:29 +0000 |
commit | fa62568aaae8fcb78df2e935eec93ddbfc7d8673 (patch) | |
tree | ed26ee45868d8cfa6d895b9e1f81dcab10257055 /pkgtools/pkg_install | |
parent | 88730fe6bc289c0cafb62683a98009572dd44633 (diff) | |
download | pkgsrc-fa62568aaae8fcb78df2e935eec93ddbfc7d8673.tar.gz |
var_get_memory():
if no eol is found in the string we set "next" to NULL, assign it
to "buf" and then check the loop condition by dereferencing it - which
does not work well.
Change the loop condition to first check for buf == NULL.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r-- | pkgtools/pkg_install/files/lib/var.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgtools/pkg_install/files/lib/var.c b/pkgtools/pkg_install/files/lib/var.c index c2c57f322e0..c212df0e9e7 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.8 2009/08/02 17:56:45 joerg Exp $ */ +/* $NetBSD: var.c,v 1.9 2013/05/17 07:27:29 martin Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: var.c,v 1.8 2009/08/02 17:56:45 joerg Exp $"); +__RCSID("$NetBSD: var.c,v 1.9 2013/05/17 07:27:29 martin Exp $"); #if HAVE_SYS_STAT_H #include <sys/stat.h> @@ -156,7 +156,7 @@ var_get_memory(const char *buf, const char *variable) value = NULL; valuelen = 0; - for (; *buf; buf = next) { + for (; buf && *buf; buf = next) { if ((eol = strchr(buf, '\n')) != NULL) { next = eol + 1; len = eol - buf; |