diff --git a/mongoose.c b/mongoose.c index 120abbf6..9f31d735 100644 --- a/mongoose.c +++ b/mongoose.c @@ -986,7 +986,7 @@ static void *ff_open(const char *path, int flags) { if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND; if (f_open(&f, path, mode) == 0) { FIL *fp = calloc(1, sizeof(*fp)); - *fp = f; + memcpy(fp, &f, sizeof(*fp)); return fp; } else { return NULL; diff --git a/src/fs_fat.c b/src/fs_fat.c index 7c2846fe..2997dd67 100644 --- a/src/fs_fat.c +++ b/src/fs_fat.c @@ -74,7 +74,7 @@ static void *ff_open(const char *path, int flags) { if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND; if (f_open(&f, path, mode) == 0) { FIL *fp = calloc(1, sizeof(*fp)); - *fp = f; + memcpy(fp, &f, sizeof(*fp)); return fp; } else { return NULL;