summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2015-11-02 19:03:26 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2015-11-02 19:03:26 +0000
commit98b98887f926be87eabccc7919e57ce625c63c03 (patch)
tree6254b888117c285432ce7e270385f20ee971cad0 /src
parent94431adbd61d7706fe6df3a19bcae043fec950bf (diff)
Avoid misaligned access in cached lookup. Bug 1708
Diffstat (limited to 'src')
-rw-r--r--src/src/search.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/src/search.c b/src/src/search.c
index cd522dae8..ccad25021 100644
--- a/src/src/search.c
+++ b/src/src/search.c
@@ -540,10 +540,10 @@ else
}
else
{
- t = store_get(sizeof(tree_node) + len + sizeof(expiring_data));
- e = (expiring_data *)((char *)t + sizeof(tree_node) + len);
+ e = store_get(sizeof(expiring_data) + sizeof(tree_node) + len);
e->expiry = do_cache == UINT_MAX ? 0 : time(NULL)+do_cache;
e->ptr = data;
+ t = (tree_node *)(e+1);
memcpy(t->name, keystring, len);
t->data.ptr = e;
tree_insertnode(&c->item_cache, t);