Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/gpt PR 50756 David Binderman: avoid running off the end...
details: https://anonhg.NetBSD.org/src/rev/acd2dbabeffe
branches: trunk
changeset: 345505:acd2dbabeffe
user: dholland <dholland%NetBSD.org@localhost>
date: Tue May 31 02:29:54 2016 +0000
description:
PR 50756 David Binderman: avoid running off the end of an array in case
thing we're looking for isn't there. Which is probably impossible, but
that's not obvious.
diffstat:
sbin/gpt/show.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 85e1e511d8a4 -r acd2dbabeffe sbin/gpt/show.c
--- a/sbin/gpt/show.c Tue May 31 02:26:00 2016 +0000
+++ b/sbin/gpt/show.c Tue May 31 02:29:54 2016 +0000
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.35 2015/12/29 16:45:04 christos Exp $");
+__RCSID("$NetBSD: show.c,v 1.36 2016/05/31 02:29:54 dholland Exp $");
#endif
#include <sys/types.h>
@@ -114,7 +114,12 @@
if (map_start == p->map_start + start)
break;
}
- printf("%d", mbr->mbr_part[i].part_typ);
+ if (i == 4) {
+ /* wasn't there */
+ printf("[partition not found?]");
+ } else {
+ printf("%d", mbr->mbr_part[i].part_typ);
+ }
break;
case MAP_TYPE_GPT_PART:
printf("GPT part ");
Home |
Main Index |
Thread Index |
Old Index