From f5e0a0f5ed38e1f9ec48836d9bbbdd8265cb1226 Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Fri, 1 Dec 2017 14:42:24 +0000 Subject: Avoid using an uninitialized variable. Found by gcc. OK jca@ --- usr.sbin/ocspcheck/ocspcheck.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ocspcheck/ocspcheck.c b/usr.sbin/ocspcheck/ocspcheck.c index 133401003e5..551a8fa091f 100644 --- a/usr.sbin/ocspcheck/ocspcheck.c +++ b/usr.sbin/ocspcheck/ocspcheck.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocspcheck.c,v 1.23 2017/11/29 21:15:45 jmc Exp $ */ +/* $OpenBSD: ocspcheck.c,v 1.24 2017/12/01 14:42:23 visa Exp $ */ /* * Copyright (c) 2017 Bob Beck @@ -632,6 +632,8 @@ main(int argc, char **argv) if (!validate_response(hget->bodypart, hget->bodypartsz, request, castore, host, certfile)) exit(1); + instaple = hget->bodypart; + instaplesz = hget->bodypartsz; } else { size_t nr = 0; instaplesz = 0; @@ -671,9 +673,9 @@ main(int argc, char **argv) (void) ftruncate(staplefd, 0); w = 0; written = 0; - while (written < hget->bodypartsz) { - w = write(staplefd, hget->bodypart + written, - hget->bodypartsz - written); + while (written < instaplesz) { + w = write(staplefd, instaple + written, + instaplesz - written); if (w == -1) { if (errno != EINTR && errno != EAGAIN) err(1, "Write of OCSP response failed"); -- cgit v1.2.3