|
|
f686d7 |
From 160c02c8071b8948231a229ec6247cf0792c389a Mon Sep 17 00:00:00 2001
|
|
|
f686d7 |
From: Filip Krska <fkrska@redhat.com>
|
|
|
f686d7 |
Date: Tue, 20 Oct 2015 18:25:38 +0200
|
|
|
f686d7 |
Subject: [PATCH 1/2] lex.c: fix malloc() signal leak in lexsave()
|
|
|
f686d7 |
|
|
|
f686d7 |
The bug appears not to affect upstream master, where the function
|
|
|
f686d7 |
|
|
|
f686d7 |
lexsave(void)
|
|
|
f686d7 |
... 1x malloc, 1x zalloc
|
|
|
f686d7 |
|
|
|
f686d7 |
was rewritten to
|
|
|
f686d7 |
|
|
|
f686d7 |
lex_context_save(struct lex_stack *ls, int toplevel)
|
|
|
f686d7 |
... no *alloc at all
|
|
|
f686d7 |
|
|
|
f686d7 |
Recheck of any possible malloc() signal leaks in current RHEL 6 zsh code needed.
|
|
|
f686d7 |
---
|
|
|
f686d7 |
Src/lex.c | 2 +-
|
|
|
f686d7 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
f686d7 |
|
|
|
f686d7 |
diff --git a/Src/lex.c b/Src/lex.c
|
|
|
f686d7 |
index 33f6430..0c7f539 100644
|
|
|
f686d7 |
--- a/Src/lex.c
|
|
|
f686d7 |
+++ b/Src/lex.c
|
|
|
f686d7 |
@@ -271,7 +271,7 @@ lexsave_partial(int parts)
|
|
|
f686d7 |
{
|
|
|
f686d7 |
struct lexstack *ls;
|
|
|
f686d7 |
|
|
|
f686d7 |
- ls = (struct lexstack *)malloc(sizeof(struct lexstack));
|
|
|
f686d7 |
+ ls = (struct lexstack *)zalloc(sizeof(struct lexstack));
|
|
|
f686d7 |
|
|
|
f686d7 |
if (parts & ZCONTEXT_LEX) {
|
|
|
f686d7 |
ls->incmdpos = incmdpos;
|
|
|
f686d7 |
--
|
|
|
f686d7 |
2.5.2
|
|
|
f686d7 |
|
|
|
f686d7 |
|
|
|
f686d7 |
From 861e4cd5f8ba169f5f63ca1efffdc8ebac5a3d61 Mon Sep 17 00:00:00 2001
|
|
|
f686d7 |
From: Kamil Dudka <kdudka@redhat.com>
|
|
|
f686d7 |
Date: Tue, 20 Oct 2015 18:27:15 +0200
|
|
|
f686d7 |
Subject: [PATCH 2/2] mem.c: queue signals while calling malloc() in realloc()
|
|
|
f686d7 |
|
|
|
f686d7 |
Bug: https://bugzilla.redhat.com/1267903#c6
|
|
|
f686d7 |
---
|
|
|
f686d7 |
Src/mem.c | 9 +++++++--
|
|
|
f686d7 |
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
f686d7 |
|
|
|
f686d7 |
diff --git a/Src/mem.c b/Src/mem.c
|
|
|
f686d7 |
index 9492a60..75622c6 100644
|
|
|
f686d7 |
--- a/Src/mem.c
|
|
|
f686d7 |
+++ b/Src/mem.c
|
|
|
f686d7 |
@@ -1513,8 +1513,13 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
|
|
|
f686d7 |
int i, l = 0;
|
|
|
f686d7 |
|
|
|
f686d7 |
/* some system..., see above */
|
|
|
f686d7 |
- if (!p && size)
|
|
|
f686d7 |
- return (MALLOC_RET_T) malloc(size);
|
|
|
f686d7 |
+ if (!p && size) {
|
|
|
f686d7 |
+ queue_signals();
|
|
|
f686d7 |
+ r = malloc(size);
|
|
|
f686d7 |
+ unqueue_signals();
|
|
|
f686d7 |
+ return (MALLOC_RET_T) r;
|
|
|
f686d7 |
+ }
|
|
|
f686d7 |
+
|
|
|
f686d7 |
/* and some systems even do this... */
|
|
|
f686d7 |
if (!p || !size)
|
|
|
f686d7 |
return (MALLOC_RET_T) p;
|
|
|
f686d7 |
--
|
|
|
f686d7 |
2.5.2
|
|
|
f686d7 |
|