1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
From 43539d6b60ef0db3e98d00bef0024614c8c1807a Mon Sep 17 00:00:00 2001
From: George McCollister <george.mccollister@gmail.com>
Date: Tue, 31 Dec 2013 14:37:32 -0600
Subject: [PATCH] journal: Add missing byte order conversions
Convert entry_array.items[0] to host byte order prior to passing it to
chain_cache_put().
[zj: also use le64toh in journal-verify.c]
https://bugs.freedesktop.org/show_bug.cgi?id=73194
Upstream-Status: Backport [Fedora]
---
src/journal/journal-file.c | 4 ++--
src/journal/journal-verify.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
Index: systemd-208/src/journal/journal-file.c
===================================================================
--- systemd-208.orig/src/journal/journal-file.c 2014-02-07 22:51:44.000000000 -0800
+++ systemd-208/src/journal/journal-file.c 2014-02-07 22:58:40.665062951 -0800
@@ -1447,7 +1447,7 @@
found:
/* Let's cache this item for the next invocation */
- chain_cache_put(f->chain_cache, ci, first, a, o->entry_array.items[0], t);
+ chain_cache_put(f->chain_cache, ci, first, a, le64toh(o->entry_array.items[0]), t);
r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
if (r < 0)
@@ -1624,7 +1624,7 @@
return 0;
/* Let's cache this item for the next invocation */
- chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t);
+ chain_cache_put(f->chain_cache, ci, first, a, le64toh(array->entry_array.items[0]), t);
if (subtract_one && i == 0)
p = last_p;
Index: systemd-208/src/journal/journal-verify.c
===================================================================
--- systemd-208.orig/src/journal/journal-verify.c 2013-08-13 13:02:46.000000000 -0700
+++ systemd-208/src/journal/journal-verify.c 2014-02-07 22:57:14.849308409 -0800
@@ -249,12 +249,12 @@
}
for (i = 0; i < journal_file_entry_array_n_items(o); i++)
- if (o->entry_array.items[i] != 0 &&
- !VALID64(o->entry_array.items[i])) {
+ if (le64toh(o->entry_array.items[i]) != 0 &&
+ !VALID64(le64toh(o->entry_array.items[i]))) {
log_error(OFSfmt": invalid object entry array item (%"PRIu64"/%"PRIu64"): "OFSfmt,
offset,
i, journal_file_entry_array_n_items(o),
- o->entry_array.items[i]);
+ le64toh(o->entry_array.items[i]));
return -EBADMSG;
}
|