Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fdisk In validate_bootsel, the code assumed that arr[j]...
details: https://anonhg.NetBSD.org/src/rev/eea2149162ff
branches: trunk
changeset: 836963:eea2149162ff
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Wed Nov 14 12:05:29 2018 +0000
description:
In validate_bootsel, the code assumed that arr[j][i] can be accessed
with something like arr[0][j*ARRAYWIDTH+i]. gcc no longer allows such
hacks and discards the code silently because of undefined behaviour.
diffstat:
sbin/fdisk/fdisk.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (39 lines):
diff -r 26b39c818bc7 -r eea2149162ff sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c Wed Nov 14 11:02:52 2018 +0000
+++ b/sbin/fdisk/fdisk.c Wed Nov 14 12:05:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdisk.c,v 1.155 2018/08/27 14:55:46 sevan Exp $ */
+/* $NetBSD: fdisk.c,v 1.156 2018/11/14 12:05:29 mlelstv Exp $ */
/*
* Mach Operating System
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.155 2018/08/27 14:55:46 sevan Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.156 2018/11/14 12:05:29 mlelstv Exp $");
#endif /* not lint */
#define MBRPTYPENAMES
@@ -2685,7 +2685,7 @@
{
unsigned int key = mbs->mbrbs_defkey;
unsigned int tmo;
- size_t i;
+ size_t i, j;
if (v_flag)
return 0;
@@ -2717,8 +2717,9 @@
/* Check the menu strings are printable */
/* Unfortunately they aren't zero filled... */
- for (i = 0; i < sizeof(mbs->mbrbs_nametab); i++) {
- int c = (uint8_t)mbs->mbrbs_nametab[0][i];
+ for (j = 0; j < __arraycount(mbs->mbrbs_nametab); ++j)
+ for (i = 0; i < sizeof(mbs->mbrbs_nametab[j]); i++) {
+ int c = (uint8_t)mbs->mbrbs_nametab[j][i];
if (c == 0 || isprint(c))
continue;
return 3;
Home |
Main Index |
Thread Index |
Old Index