From 2b91962df89953f63592ed929fbc45c1e83645e7 Mon Sep 17 00:00:00 2001 From: Charlotte Koch Date: Sat, 11 Jul 2020 17:35:12 -0700 Subject: [PATCH] XPK: Avoid weird pointer arithmetic that sometimes segfaults --- src/xpk/xpk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/xpk/xpk.c b/src/xpk/xpk.c index 89370df..a4b9183 100644 --- a/src/xpk/xpk.c +++ b/src/xpk/xpk.c @@ -130,15 +130,13 @@ XPK_NewFromFile(const char *path, LPStatus *status) /* XXX check for malloc error */ xpk->offsets = calloc(xpk->n_entries, sizeof(uint32_t)); - uint32_t **p = &xpk->offsets; for (int i = 0; i < xpk->n_entries; i++) { uint32_t offset; ReadUint32(f, 1, &offset); uint32_t absolute_offset = offsets_start_pos + offset; - **p = absolute_offset; + xpk->offsets[i] = absolute_offset; xpk->entries[i]->offset = absolute_offset; - p++; } *status = LUNAPURPURA_OK;