commit a4153d5b903b1fe20edad776a6d0ec3c3cbcc0aa from: Stefan Sperling date: Thu Dec 17 23:13:10 2020 UTC more concise fix for path_list_reverse_input() crash; suggested by millert commit - 8891c2aba6a5f6cd43ab51b67115d4fbd0976f73 commit + a4153d5b903b1fe20edad776a6d0ec3c3cbcc0aa blob - 231a6477402c69e760b2ab21b75fee238ebbddff blob + cb17e05405edca193cab8ab4da47e83af9ed79a6 --- regress/path/path_test.c +++ regress/path/path_test.c @@ -178,19 +178,14 @@ path_list_reverse_input(void) size_t i; TAILQ_INIT(&paths); - for (i = nitems(path_list_input) - 1; i > 0; i--) { - err = got_pathlist_insert(NULL, &paths, path_list_input[i], + for (i = nitems(path_list_input); i > 0;) { + err = got_pathlist_insert(NULL, &paths, path_list_input[--i], NULL); if (err) { test_printf("%s\n", __func__, err->msg); 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) {