diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2019-03-16 17:03:57 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2019-03-16 17:03:57 +0100 |
| commit | a885f84a89334ba7c903f5e31d31e9ca5497356f (patch) | |
| tree | bf2d6a7e12b1598fcae28cb3395a99cc8439d1ee /src/cc4group.c | |
| parent | 58bc74b6fdd58e870e2bbb1503148f79f0726306 (diff) | |
| download | cc4group-a885f84a89334ba7c903f5e31d31e9ca5497356f.tar.gz cc4group-a885f84a89334ba7c903f5e31d31e9ca5497356f.zip | |
Fix setEntryData storing the wrong data pointer and crashing
Diffstat (limited to 'src/cc4group.c')
| -rw-r--r-- | src/cc4group.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/cc4group.c b/src/cc4group.c index 48fa931..f980183 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -1890,6 +1890,10 @@ static bool cc4group_setEntryData(CC4Group* const this, const char* const entryP if(entry->data != NULL) { cc4group_applyMemoryManagementEnd(entry->memoryManagement, entry->data); + + entry->data = NULL; + entry->core.Size = 0; + entry->memoryManagement = Reference; } if(data != NULL && size != 0) @@ -1902,17 +1906,11 @@ static bool cc4group_setEntryData(CC4Group* const this, const char* const entryP } else { - entry->data = (void*)data; + entry->data = (uint8_t*)ownData; } entry->core.Size = size; entry->memoryManagement = memoryManagement; } - else - { - entry->data = NULL; - entry->core.Size = 0; - entry->memoryManagement = Reference; - } entry->core.HasCRC = C4GroupEntryCore_NoCRC; |
