From f0d03845d316fb78b752d80756ae8bc0e55c914b Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 14 Jun 2021 12:46:47 +0000 Subject: [PATCH] Somewhere in the recent churn a couple of memset()'s inadvertantly got lost. Restore merciless zapping of gpt header & partition entries when '-i -g' or 'reinit [gpt]' are invoked. --- sbin/fdisk/gpt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index fd0e7ed614e..f123d876a48 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.28 2021/06/13 13:48:00 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.29 2021/06/14 12:46:47 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -382,6 +382,7 @@ init_gh(void) uint32_t status; memcpy(&oldgh, &gh, sizeof(oldgh)); + memset(&gh, 0, sizeof(gh)); needed = sizeof(gp) / secsize + 2; @@ -422,6 +423,7 @@ init_gp(void) int rslt; memcpy(&oldgp, &gp, sizeof(oldgp)); + memset(&gp, 0, sizeof(gp)); rslt = 0; if (b_arg > 0) { -- 2.20.1