svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

Blame SOURCES/bash-cve-2016-9401.patch

ff19ae
diff --git a/builtins/pushd.def b/builtins/pushd.def
ff19ae
index 05b7529..4eb0132 100644
ff19ae
--- a/builtins/pushd.def
ff19ae
+++ b/builtins/pushd.def
ff19ae
@@ -353,7 +353,7 @@ popd_builtin (list)
ff19ae
 	break;
ff19ae
     }
ff19ae
 
ff19ae
-  if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
ff19ae
+  if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
ff19ae
     {
ff19ae
       pushd_error (directory_list_offset, which_word ? which_word : "");
ff19ae
       return (EXECUTION_FAILURE);
ff19ae
@@ -375,6 +375,11 @@ popd_builtin (list)
ff19ae
 	 remove that directory from the list and shift the remainder
ff19ae
 	 of the list into place. */
ff19ae
       i = (direction == '+') ? directory_list_offset - which : which;
ff19ae
+      if (i < 0 || i > directory_list_offset)
ff19ae
+	{
ff19ae
+	  pushd_error (directory_list_offset, which_word ? which_word : "");
ff19ae
+	  return (EXECUTION_FAILURE);
ff19ae
+	}
ff19ae
       free (pushd_directory_list[i]);
ff19ae
       directory_list_offset--;
ff19ae
 
ff19ae
-- 
ff19ae
2.9.3
ff19ae