From 51dff02e65f0f5c6455db1a958d30a6e05512896 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 29 Mar 2022 13:57:52 +0000 Subject: [PATCH] off-by-one check didn't recognize partition 'a' section on specified disk, and would fall through to the active partition selection from crystal kolipe, ok miod krw --- sys/arch/amd64/stand/libsa/cmd_i386.c | 6 +++--- sys/arch/i386/stand/libsa/cmd_i386.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arch/amd64/stand/libsa/cmd_i386.c b/sys/arch/amd64/stand/libsa/cmd_i386.c index 1f928af37f7..3961ee8b671 100644 --- a/sys/arch/amd64/stand/libsa/cmd_i386.c +++ b/sys/arch/amd64/stand/libsa/cmd_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_i386.c,v 1.14 2019/05/10 21:20:43 mlarkin Exp $ */ +/* $OpenBSD: cmd_i386.c,v 1.15 2022/03/29 13:57:52 deraadt Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -107,7 +107,7 @@ Xboot(void) dev += (cmd.argv[1][2] - '0'); part = (cmd.argv[1][3] - 'a'); - if (part > 0) + if (part >= 0) printf("[%x,%d]\n", dev, part); else printf("[%x]\n", dev); @@ -119,7 +119,7 @@ Xboot(void) goto bad; /* Frob boot flag in buffer from HD */ - if ((dev & 0x80) && (part > 0)){ + if ((dev & 0x80) && (part >= 0)) { int i, j; for (i = 0, j = DOSPARTOFF; i < 4; i++, j += 16) diff --git a/sys/arch/i386/stand/libsa/cmd_i386.c b/sys/arch/i386/stand/libsa/cmd_i386.c index 0a034f820cc..0361cecb5a5 100644 --- a/sys/arch/i386/stand/libsa/cmd_i386.c +++ b/sys/arch/i386/stand/libsa/cmd_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_i386.c,v 1.36 2016/06/10 18:36:06 jcs Exp $ */ +/* $OpenBSD: cmd_i386.c,v 1.37 2022/03/29 13:57:53 deraadt Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -119,7 +119,7 @@ Xboot(void) dev += (cmd.argv[1][2] - '0'); part = (cmd.argv[1][3] - 'a'); - if (part > 0) + if (part >= 0) printf("[%x,%d]\n", dev, part); else printf("[%x]\n", dev); @@ -131,7 +131,7 @@ Xboot(void) goto bad; /* Frob boot flag in buffer from HD */ - if ((dev & 0x80) && (part > 0)){ + if ((dev & 0x80) && (part >= 0)) { int i, j; for (i = 0, j = DOSPARTOFF; i < 4; i++, j += 16) -- 2.20.1