Skip to content

Commit

Permalink
Merge pull request #2248 from meganz/bug/crc-calculation-segfaults
Browse files Browse the repository at this point in the history
SDK-1223. Hotfix over 3.7.4. Crash when obtaining CRCfix crash when obtaining CRC
  • Loading branch information
sergiohs84 authored Sep 18, 2020
2 parents feb3eeb + 8ecbfd2 commit 96e038a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,14 @@ void EncryptByChunks::updateCRC(byte* data, unsigned size, unsigned offset)
{
uint32_t *intc = (uint32_t *)crc;

int ol = offset % CRCSIZE;
unsigned ol = offset % CRCSIZE;
if (ol)
{
int ll = CRCSIZE - ol;
unsigned ll = CRCSIZE - ol;
if (ll > size) //last chunks could be smaller than CRCSIZE!
{
ll = size;
}
size -= ll;
while (ll--)
{
Expand Down

0 comments on commit 96e038a

Please sign in to comment.