Skip to content

Commit 8f3ae23

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 4c1e421 commit 8f3ae23

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
@@ -917,8 +917,13 @@ static const UCHAR* sdl_desc(const UCHAR* ptr, DSC* desc)
917917
case dtype_text:
918918
case dtype_cstring:
919919
case dtype_varying:
920-
desc->dsc_length += get_word(sdl);
920+
{
921+
const auto length = get_word(sdl);
922+
desc->dsc_length += length;
923+
if (length == 0 || desc->dsc_length == 0)
924+
return nullptr;
921925
break;
926+
}
922927

923928
default:
924929
break;

0 commit comments

Comments
 (0)