summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-12-16 23:35:30 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-12-16 23:37:38 +0100
commit4faa70046ca0c1775c8e231179716a78cf3291b1 (patch)
tree3d8b8b98fdfcfc80e43b1d3c2084f644d4b8b742 /src/journal
parenteca7a27add5aa3ec85c272fc4cef287fdca034ce (diff)
journal-file: protect against alloca(0)
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 4009b29b46..48fdb6163a 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2730,7 +2730,8 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
ts.realtime = le64toh(o->entry.realtime);
n = journal_file_entry_n_items(o);
- items = alloca(sizeof(EntryItem) * n);
+ /* alloca() can't take 0, hence let's allocate at least one */
+ items = alloca(sizeof(EntryItem) * MAX(1u, n));
for (i = 0; i < n; i++) {
uint64_t l, h;