Skip to content

Commit 9c58018

Browse files
TreeHunter9Artyom Ivanov
andauthored
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 7464f45 commit 9c58018

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/common/sdl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,13 @@ static const UCHAR* sdl_desc(const UCHAR* ptr, DSC* desc)
928928
case dtype_text:
929929
case dtype_cstring:
930930
case dtype_varying:
931-
desc->dsc_length += get_word(sdl);
931+
{
932+
const auto length = get_word(sdl);
933+
desc->dsc_length += length;
934+
if (length == 0 || desc->dsc_length == 0)
935+
return nullptr;
932936
break;
937+
}
933938

934939
default:
935940
break;

0 commit comments

Comments
 (0)