9014c4
From 44bfefc553993613c0aff992bc4f3078d738ee1d Mon Sep 17 00:00:00 2001
9014c4
From: Chet Ramey <chet.ramey@case.edu>
9014c4
Date: Fri, 20 Jan 2017 11:47:31 -0500
9014c4
Subject: [PATCH] Bash-4.4 patch 6
9014c4
9014c4
---
9014c4
 builtins/pushd.def | 7 ++++++-
9014c4
 patchlevel.h       | 2 +-
9014c4
 2 files changed, 7 insertions(+), 2 deletions(-)
9014c4
9014c4
diff --git a/builtins/pushd.def b/builtins/pushd.def
9014c4
index 82653c4..6579e4c 100644
9014c4
--- a/builtins/pushd.def
9014c4
+++ b/builtins/pushd.def
9014c4
@@ -365,7 +365,7 @@ popd_builtin (list)
9014c4
 	break;
9014c4
     }
9014c4
 
9014c4
-  if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
9014c4
+  if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
9014c4
     {
9014c4
       pushd_error (directory_list_offset, which_word ? which_word : "");
9014c4
       return (EXECUTION_FAILURE);
9014c4
@@ -387,6 +387,11 @@ popd_builtin (list)
9014c4
 	 remove that directory from the list and shift the remainder
9014c4
 	 of the list into place. */
9014c4
       i = (direction == '+') ? directory_list_offset - which : which;
9014c4
+      if (i < 0 || i > directory_list_offset)
9014c4
+	{
9014c4
+	  pushd_error (directory_list_offset, which_word ? which_word : "");
9014c4
+	  return (EXECUTION_FAILURE);
9014c4
+	}
9014c4
       free (pushd_directory_list[i]);
9014c4
       directory_list_offset--;
9014c4
 
9014c4
diff --git a/patchlevel.h b/patchlevel.h
9014c4
index 1bc098b..14bff9f 100644
9014c4
--- a/patchlevel.h
9014c4
+++ b/patchlevel.h
9014c4
@@ -25,6 +25,6 @@
9014c4
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
9014c4
    looks for to find the patch level (for the sccs version string). */
9014c4
 
9014c4
-#define PATCHLEVEL 5
9014c4
+#define PATCHLEVEL 6
9014c4
 
9014c4
 #endif /* _PATCHLEVEL_H_ */
9014c4
-- 
9014c4
2.9.3
9014c4