mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-25 19:09:52 +03:00
Merge pull request #1829 from chipitsine/master
src/Mayaqua/Str.c: fix denial of service reported by Cisco Talos
This commit is contained in:
commit
8fc27da780
@ -2062,11 +2062,11 @@ void EnSafeHttpHeaderValueStr(char *str, char replace)
|
|||||||
length = StrLen(str);
|
length = StrLen(str);
|
||||||
while (index < length)
|
while (index < length)
|
||||||
{
|
{
|
||||||
if (str[index] == '\r' || str[index] == '\n')
|
if ((str[index] == '\r' || str[index] == '\n') && length - index > 1)
|
||||||
{
|
{
|
||||||
if (replace == ' ')
|
if (replace == ' ')
|
||||||
{
|
{
|
||||||
Move(&str[index], &str[index + 1], length - index);
|
Move(&str[index], &str[index + 1], length - index - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2075,12 +2075,12 @@ void EnSafeHttpHeaderValueStr(char *str, char replace)
|
|||||||
}
|
}
|
||||||
else if (str[index] == '\\')
|
else if (str[index] == '\\')
|
||||||
{
|
{
|
||||||
if (str[index + 1] == 'r' || str[index + 1] == 'n')
|
if ((str[index + 1] == 'r' || str[index + 1] == 'n') && length - index > 2)
|
||||||
{
|
{
|
||||||
if (replace == ' ')
|
if (replace == ' ')
|
||||||
{
|
{
|
||||||
Move(&str[index], &str[index + 2], length - index);
|
Move(&str[index], &str[index + 2], length - index - 2);
|
||||||
index--;
|
index++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user