Module Name: src Committed By: christos Date: Sat May 29 17:41:51 UTC 2021
Modified Files: src/sbin/disklabel: main.c Log Message: first check, then copy To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sbin/disklabel/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/disklabel/main.c diff -u src/sbin/disklabel/main.c:1.55 src/sbin/disklabel/main.c:1.56 --- src/sbin/disklabel/main.c:1.55 Mon Sep 28 22:58:52 2020 +++ src/sbin/disklabel/main.c Sat May 29 13:41:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.55 2020/09/29 02:58:52 msaitoh Exp $ */ +/* $NetBSD: main.c,v 1.56 2021/05/29 17:41:51 christos Exp $ */ /* * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19 static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ #else -__RCSID("$NetBSD: main.c,v 1.55 2020/09/29 02:58:52 msaitoh Exp $"); +__RCSID("$NetBSD: main.c,v 1.56 2021/05/29 17:41:51 christos Exp $"); #endif #endif /* not lint */ @@ -1238,9 +1238,9 @@ find_label(int f, u_int sector) if (i == LABEL_OFFSET) continue; disk_lp = (void *)(bootarea + offset); - memcpy(&tlp, disk_lp, sizeof(tlp)); if ((char *)(disk_lp + 1) > bootarea + bootarea_len) break; + memcpy(&tlp, disk_lp, sizeof(tlp)); if (tlp.d_magic2 != tlp.d_magic) continue; if (read_all && (tlp.d_magic == DISKMAGIC_DELETED ||