psss / rpms / bash

Forked from rpms/bash 6 years ago
Clone
Roman Rakus 3a5a59c
			     BASH PATCH REPORT
Roman Rakus 3a5a59c
			     =================
Roman Rakus 3a5a59c
Roman Rakus 3a5a59c
Bash-Release:	4.2
Roman Rakus 3a5a59c
Patch-ID:	bash42-011
Roman Rakus 3a5a59c
Roman Rakus 3a5a59c
Bug-Reported-by:	"David Parks" <davidparks21@yahoo.com>
Roman Rakus 3a5a59c
Bug-Reference-ID:	<014101cc82c6$46ac1540$d4043fc0$@com>
Roman Rakus 3a5a59c
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html
Roman Rakus 3a5a59c
Roman Rakus 3a5a59c
Bug-Description:
Roman Rakus 3a5a59c
Roman Rakus 3a5a59c
Overwriting a value in an associative array causes the memory allocated to
Roman Rakus 3a5a59c
store the key on the second and subsequent assignments to leak.
Roman Rakus 3a5a59c
Roman Rakus 3a5a59c
Patch (apply with `patch -p0'):
Roman Rakus 3a5a59c
Roman Rakus 3a5a59c
*** ../bash-4.2-patched/assoc.c	2009-08-05 20:19:40.000000000 -0400
Roman Rakus 3a5a59c
--- assoc.c	2011-10-04 20:23:07.000000000 -0400
Roman Rakus 3a5a59c
***************
Roman Rakus 3a5a59c
*** 78,81 ****
Roman Rakus 3a5a59c
--- 78,86 ----
Roman Rakus 3a5a59c
    if (b == 0)
Roman Rakus 3a5a59c
      return -1;
Roman Rakus 3a5a59c
+   /* If we are overwriting an existing element's value, we're not going to
Roman Rakus 3a5a59c
+      use the key.  Nothing in the array assignment code path frees the key
Roman Rakus 3a5a59c
+      string, so we can free it here to avoid a memory leak. */
Roman Rakus 3a5a59c
+   if (b->key != key)
Roman Rakus 3a5a59c
+     free (key);
Roman Rakus 3a5a59c
    FREE (b->data);
Roman Rakus 3a5a59c
    b->data = value ? savestring (value) : (char *)0;
Roman Rakus 3a5a59c
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
Roman Rakus 3a5a59c
--- patchlevel.h	Thu Feb 24 21:41:34 2011
Roman Rakus 3a5a59c
***************
Roman Rakus 3a5a59c
*** 26,30 ****
Roman Rakus 3a5a59c
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 3a5a59c
  
Roman Rakus 3a5a59c
! #define PATCHLEVEL 10
Roman Rakus 3a5a59c
  
Roman Rakus 3a5a59c
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus 3a5a59c
--- 26,30 ----
Roman Rakus 3a5a59c
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 3a5a59c
  
Roman Rakus 3a5a59c
! #define PATCHLEVEL 11
Roman Rakus 3a5a59c
  
Roman Rakus 3a5a59c
  #endif /* _PATCHLEVEL_H_ */