From 1bcfab7f56ffbff876ff6b59ea38e4aecd9c9f9b Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Tue, 22 Mar 2005 22:05:44 +0000 Subject: [PATCH] Fix use of uninitialized buf[0]. Reported by: stefanf MFC after: 3 days --- sbin/geom/core/geom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index ea28819d0657..c25157c538da 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -425,6 +425,7 @@ run_command(int argc, char *argv[]) gctl_ro_param(req, "version", sizeof(*version), version); parse_arguments(cmd, req, &argc, &argv); + bzero(buf, sizeof(buf)); if (cmd->gc_func != NULL) { unsigned flags; @@ -432,7 +433,6 @@ run_command(int argc, char *argv[]) cmd->gc_func(req, flags); errstr = req->error; } else { - bzero(buf, sizeof(buf)); gctl_rw_param(req, "output", sizeof(buf), buf); errstr = gctl_issue(req); } @@ -443,7 +443,7 @@ run_command(int argc, char *argv[]) exit(EXIT_FAILURE); } } - if (*buf != '\0') + if (buf[0] != '\0') printf("%s", buf); gctl_free(req); if (verbose)