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