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