summaryrefslogtreecommitdiff
path: root/e2fsprogs/ext2fs/ext2fs_inline.c
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/ext2fs/ext2fs_inline.c')
-rw-r--r--e2fsprogs/ext2fs/ext2fs_inline.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c
index 73d393d..a363b19 100644
--- a/e2fsprogs/ext2fs/ext2fs_inline.c
+++ b/e2fsprogs/ext2fs/ext2fs_inline.c
@@ -44,12 +44,14 @@ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
unsigned long size, void *ptr)
{
void *p;
- void **pp = (void **)ptr;
- p = realloc(*pp, size);
+ /* Use "memcpy" for pointer assignments here to avoid problems
+ * with C99 strict type aliasing rules. */
+ memcpy(&p, ptr, sizeof (p));
+ p = realloc(p, size);
if (!p)
return EXT2_ET_NO_MEMORY;
- *pp = p;
+ memcpy(ptr, &p, sizeof (p));
return 0;
}