7 Bug-Reported-by: <fernando@null-life.com>
8 Bug-Reference-ID: <CAEr-gPFPvqheiAeENmMkEwWRd4U=1iqCsYmR3sLdULOqL++_tQ@mail.gmail.com>
13 Out-of-range negative offsets to popd can cause the shell to crash attempting
14 to free an invalid memory block.
16 Patch (apply with `patch -p0'):
18 *** ../bash-4.4-patched/builtins/pushd.def 2016-01-25 13:31:49.000000000 -0500
19 --- builtins/pushd.def 2016-10-28 10:46:49.000000000 -0400
24 ! if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
26 pushd_error (directory_list_offset, which_word ? which_word : "");
30 ! if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
32 pushd_error (directory_list_offset, which_word ? which_word : "");
36 of the list into place. */
37 i = (direction == '+') ? directory_list_offset - which : which;
38 + if (i < 0 || i > directory_list_offset)
40 + pushd_error (directory_list_offset, which_word ? which_word : "");
41 + return (EXECUTION_FAILURE);
43 free (pushd_directory_list[i]);
44 directory_list_offset--;
45 *** ../bash-4.4/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
46 --- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
49 looks for to find the patch level (for the sccs version string). */
51 ! #define PATCHLEVEL 5
53 #endif /* _PATCHLEVEL_H_ */
55 looks for to find the patch level (for the sccs version string). */
57 ! #define PATCHLEVEL 6
59 #endif /* _PATCHLEVEL_H_ */