diff options
Diffstat (limited to 'sbin/fdisk/gpt.c')
-rw-r--r-- | sbin/fdisk/gpt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index 65e7e8eeb66..8e8badfe0b9 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.92 2023/06/19 23:11:19 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.93 2023/06/20 11:52:08 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller <mmu@grummel.net> * Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org> @@ -77,10 +77,9 @@ name_to_string(const unsigned int pn) static char name[GPTPARTNAMESIZE + 1]; unsigned int i; - memset(name, 0, sizeof(name)); - - for (i = 0; i < sizeof(name) && gp[pn].gp_name[i] != 0; i++) + for (i = 0; i < GPTPARTNAMESIZE && gp[pn].gp_name[i] != 0; i++) name[i] = letoh16(gp[pn].gp_name[i]) & 0x7F; + name[i] = '\0'; return name; } |