Blame SOURCES/0138-journal-file-protect-against-alloca-0.patch
|
|
9fc0f6 |
From d3bf15d0b7c461aae4d97fe6425a6f0cea277222 Mon Sep 17 00:00:00 2001
|
|
|
9fc0f6 |
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
|
|
|
9fc0f6 |
Date: Mon, 16 Dec 2013 23:35:30 +0100
|
|
|
9fc0f6 |
Subject: [PATCH] journal-file: protect against alloca(0)
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
---
|
|
|
9fc0f6 |
src/journal/journal-file.c | 3 ++-
|
|
|
9fc0f6 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
|
|
|
9fc0f6 |
index 962cdd6..ebf72f3 100644
|
|
|
9fc0f6 |
--- a/src/journal/journal-file.c
|
|
|
9fc0f6 |
+++ b/src/journal/journal-file.c
|
|
|
9fc0f6 |
@@ -2730,7 +2730,8 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
|
|
|
9fc0f6 |
ts.realtime = le64toh(o->entry.realtime);
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
n = journal_file_entry_n_items(o);
|
|
|
9fc0f6 |
- items = alloca(sizeof(EntryItem) * n);
|
|
|
9fc0f6 |
+ /* alloca() can't take 0, hence let's allocate at least one */
|
|
|
9fc0f6 |
+ items = alloca(sizeof(EntryItem) * MAX(1u, n));
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
for (i = 0; i < n; i++) {
|
|
|
9fc0f6 |
uint64_t l, h;
|