Change ff_open to explicit memcpy()

This commit is contained in:
Sergey Lyubka committed 2022-07-11 18:13:46 +01:00
1 parent f40b272eeb
commit 46af09f776
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;