Skip to content

Commit 7b296fa

Browse files
authored
Merge pull request #2991 from cesanta/unpacked_crash
Fix mg_unpacked() crash
2 parents 1e1efa2 + 00c8f8a commit 7b296fa

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mongoose.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,8 @@ struct packed_file {
977977
#if MG_ENABLE_PACKED_FS
978978
#else
979979
const char *mg_unpack(const char *path, size_t *size, time_t *mtime) {
980-
*size = 0, *mtime = 0;
980+
if (size != NULL) *size = 0;
981+
if (mtime != NULL) *mtime = 0;
981982
(void) path;
982983
return NULL;
983984
}

src/fs_packed.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ struct packed_file {
1111
#if MG_ENABLE_PACKED_FS
1212
#else
1313
const char *mg_unpack(const char *path, size_t *size, time_t *mtime) {
14-
*size = 0, *mtime = 0;
14+
if (size != NULL) *size = 0;
15+
if (mtime != NULL) *mtime = 0;
1516
(void) path;
1617
return NULL;
1718
}

0 commit comments

Comments
 (0)