From 987dc1497f7a6530b053270c8e4644c75e862ca5 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 27 Dec 2019 15:45:53 +1100 Subject: [PATCH] vpatch: guard against patch list being empty. Mostly and empty list works, but get_prev() can mess up - so fix it. Signed-off-by: NeilBrown --- vpatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpatch.c b/vpatch.c index 9c37562..a1aa035 100644 --- a/vpatch.c +++ b/vpatch.c @@ -2427,7 +2427,7 @@ static void calc_one(struct plist *pl, FILE *f, int reverse, static int get_prev(int pos, struct plist *pl, int n, int mode) { int found = 0; - if (pos == -1) + if (pos == -1 || pl == NULL) return pos; do { if (pl[pos].prev == -1) -- 2.39.5