129-upstream-bash43-029.patch (1484B)
1 BASH PATCH REPORT 2 ================= 3 4 Bash-Release: 4.3 5 Patch-ID: bash43-029 6 7 Bug-Reported-by: Michal Zalewski <lcamtuf@coredump.cx> 8 Bug-Reference-ID: 9 Bug-Reference-URL: 10 11 Bug-Description: 12 13 When bash is parsing a function definition that contains a here-document 14 delimited by end-of-file (or end-of-string), it leaves the closing delimiter 15 uninitialized. This can result in an invalid memory access when the parsed 16 function is later copied. 17 18 Patch (apply with `patch -p0'): 19 20 --- a/make_cmd.c 21 +++ b/make_cmd.c 22 @@ -692,6 +692,7 @@ make_redirection (source, instruction, d 23 /* First do the common cases. */ 24 temp->redirector = source; 25 temp->redirectee = dest_and_filename; 26 + temp->here_doc_eof = 0; 27 temp->instruction = instruction; 28 temp->flags = 0; 29 temp->rflags = flags; 30 --- a/copy_cmd.c 31 +++ b/copy_cmd.c 32 @@ -126,7 +126,7 @@ copy_redirect (redirect) 33 { 34 case r_reading_until: 35 case r_deblank_reading_until: 36 - new_redirect->here_doc_eof = savestring (redirect->here_doc_eof); 37 + new_redirect->here_doc_eof = redirect->here_doc_eof ? savestring (redirect->here_doc_eof) : 0; 38 /*FALLTHROUGH*/ 39 case r_reading_string: 40 case r_appending_to: 41 --- a/patchlevel.h 42 +++ b/patchlevel.h 43 @@ -25,6 +25,6 @@ 44 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 45 looks for to find the patch level (for the sccs version string). */ 46 47 -#define PATCHLEVEL 28 48 +#define PATCHLEVEL 29 49 50 #endif /* _PATCHLEVEL_H_ */