From 00c8f8acd09d6b7a9d866598382ef9ee79719715 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Wed, 18 Dec 2024 09:57:18 +0000 Subject: [PATCH] Fix mg_unpacked() crash --- mongoose.c | 3 ++- src/fs_packed.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 28fb22c0..c5343439 100644 --- a/mongoose.c +++ b/mongoose.c @@ -977,7 +977,8 @@ struct packed_file { #if MG_ENABLE_PACKED_FS #else const char *mg_unpack(const char *path, size_t *size, time_t *mtime) { - *size = 0, *mtime = 0; + if (size != NULL) *size = 0; + if (mtime != NULL) *mtime = 0; (void) path; return NULL; } diff --git a/src/fs_packed.c b/src/fs_packed.c index 0ef29e6e..1c4caf75 100644 --- a/src/fs_packed.c +++ b/src/fs_packed.c @@ -11,7 +11,8 @@ struct packed_file { #if MG_ENABLE_PACKED_FS #else const char *mg_unpack(const char *path, size_t *size, time_t *mtime) { - *size = 0, *mtime = 0; + if (size != NULL) *size = 0; + if (mtime != NULL) *mtime = 0; (void) path; return NULL; }