Module Name: src
Committed By: dholland
Date: Tue May 31 02:29:54 UTC 2016
Modified Files:
src/sbin/gpt: show.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sbin/gpt/show.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/gpt/show.c
diff -u src/sbin/gpt/show.c:1.35 src/sbin/gpt/show.c:1.36
--- src/sbin/gpt/show.c:1.35 Tue Dec 29 16:45:04 2015
+++ src/sbin/gpt/show.c Tue May 31 02:29:54 2016
@@ -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 @@ print_part_type(int map_type, int flags,
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 ");