Commit 8891c2aba6a5f6cd43ab51b67115d4fbd0976f73

Stefan Sperling 2020-12-17T20:46:54

fix crash in path_list_reverse_input() after switch to unsigned loop index

diff --git a/regress/path/path_test.c b/regress/path/path_test.c
index 792c8cd..231a647 100644
--- a/regress/path/path_test.c
+++ b/regress/path/path_test.c
@@ -178,7 +178,7 @@ path_list_reverse_input(void)
 	size_t i;
 
 	TAILQ_INIT(&paths);
-	for (i = nitems(path_list_input) - 1; i >= 0; i--) {
+	for (i = nitems(path_list_input) - 1; i > 0; i--) {
 		err = got_pathlist_insert(NULL, &paths, path_list_input[i],
 		    NULL);
 		if (err) {
@@ -186,6 +186,11 @@ path_list_reverse_input(void)
 			return 0;
 		}
 	}
+	err = got_pathlist_insert(NULL, &paths, path_list_input[0], NULL);
+	if (err) {
+		test_printf("%s\n", __func__, err->msg);
+		return 0;
+	}
 
 	i = 0;
 	TAILQ_FOREACH(pe, &paths, entry) {