From: deraadt Date: Tue, 29 Mar 2022 13:57:52 +0000 (+0000) Subject: off-by-one check didn't recognize partition 'a' section on specified X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=51dff02e65f0f5c6455db1a958d30a6e05512896;p=openbsd 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 --- 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)