mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-13 00:34:35 +02:00
Stream#ReadLine(): fix false positive buffer underflow indicator
refs #6354
This commit is contained in:
parent
eb1f37905d
commit
02d1f1cc57
@ -143,7 +143,16 @@ StreamReadStatus Stream::ReadLine(String *line, StreamReadContext& context, bool
|
||||
}
|
||||
}
|
||||
|
||||
context.MustRead = (count <= 1);
|
||||
switch (count) {
|
||||
case 0:
|
||||
context.MustRead = true;
|
||||
break;
|
||||
case 1:
|
||||
context.MustRead = first_newline == (context.Size - 1u);
|
||||
break;
|
||||
default:
|
||||
context.MustRead = false;
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
*line = String(context.Buffer, &(context.Buffer[first_newline]));
|
||||
|
Loading…
x
Reference in New Issue
Block a user