Skip to content

Commit df0f959

Browse files
TreeHunter9Artyom Ivanov
authored andcommitted
Merge commit from fork
* fix(protocol): Treat string descriptor with zero dsc_length as invalid slice descriptor Do not use this descriptor in calculation due to possible division by zero; * fix(protocol): Check data length and dsc length separately --------- Co-authored-by: Artyom Ivanov <artyom.ivanov@red-soft.ru>
1 parent a4994f2 commit df0f959

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/common/sdl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,13 @@ static const UCHAR* sdl_desc(const UCHAR* ptr, DSC* desc)
882882
case dtype_text:
883883
case dtype_cstring:
884884
case dtype_varying:
885-
desc->dsc_length += get_word(sdl);
885+
{
886+
const auto length = get_word(sdl);
887+
desc->dsc_length += length;
888+
if (length == 0 || desc->dsc_length == 0)
889+
return nullptr;
886890
break;
891+
}
887892

888893
default:
889894
break;

0 commit comments

Comments
 (0)