diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-07-16 17:22:39 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-07-16 17:22:39 -0300 |
| commit | 6d498fe17dab48cfd8fc8a4da62a573b799e10ba (patch) | |
| tree | 1c8d55bd907b35abf014385dbedb90b2ae98f96a /src/strings.cc | |
| parent | e65dc561acab7a9e49f59777f16cb040c574c64d (diff) | |
| download | game-6d498fe17dab48cfd8fc8a4da62a573b799e10ba.tar.gz game-6d498fe17dab48cfd8fc8a4da62a573b799e10ba.zip | |
fix most init and parsing bugs + critical bug with dynamic strings
With an appropriate query manager, the server now starts up and
seems to work but won't properly handle connections until we fix
the problem with threads and signals described in `TODO.md`.
Diffstat (limited to 'src/strings.cc')
| -rw-r--r-- | src/strings.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/strings.cc b/src/strings.cc index d0bfe70..95471d6 100644 --- a/src/strings.cc +++ b/src/strings.cc @@ -183,8 +183,8 @@ void CleanupDynamicStrings(void){ if(Block->EntryType[i] == DYNAMIC_STRING_DELETED){ int StringOffset = Block->StringOffset[i]; char *String = &Block->Text[StringOffset]; - int StringLen = (int)strlen(String); - int StringEnd = StringOffset + StringLen + 1; + int StringSize = (int)strlen(String) + 1; + int StringEnd = StringOffset + StringSize; Block->EntryType[i] = DYNAMIC_STRING_FREE; if(StringEnd > DynamicBlockSize){ @@ -193,13 +193,14 @@ void CleanupDynamicStrings(void){ } if(StringEnd < DynamicBlockSize){ - memmove(String, String + StringEnd, DynamicBlockSize - StringEnd); + memmove(String, String + StringSize, DynamicBlockSize - StringEnd); } for(int j = 0; j < DynamicBlockEntries; j += 1){ if(Block->EntryType[j] != DYNAMIC_STRING_FREE - && Block->StringOffset[j] > StringOffset){ - Block->StringOffset[j] -= StringLen + 1; + && Block->StringOffset[j] > StringOffset){ + ASSERT(Block->StringOffset[j] >= StringEnd); + Block->StringOffset[j] -= StringSize; } } } |
