Skip to content

Commit

Permalink
fix some code
Browse files Browse the repository at this point in the history
  • Loading branch information
hggq committed May 16, 2024
1 parent 6feac3c commit 67e515b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions vendor/httpserver/src/http_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ void httpparse::readboundaryline(const unsigned char *buffer, unsigned int buffe
postfieldtype = 2;
}
i++;
if (buffer[i] == 0x0A && i < buffersize)
if (i < buffersize && buffer[i] == 0x0A)
{
i++;
}
Expand All @@ -1692,11 +1692,11 @@ void httpparse::readformfilename(const unsigned char *buffer, unsigned int buffe
{
if (headendhitnum == 2)
{
if (buffer[i] == 0x0D && i < buffersize && headendhitnum < 4)
if (i < buffersize && buffer[i] == 0x0D && headendhitnum < 4)
{
i++;
headendhitnum++;
if (buffer[i] == 0x0A && i < buffersize && headendhitnum < 4)
if (i < buffersize && buffer[i] == 0x0A && headendhitnum < 4)
{
i++;
headendhitnum++;
Expand All @@ -1705,15 +1705,15 @@ void httpparse::readformfilename(const unsigned char *buffer, unsigned int buffe
}
else
{
if (buffer[i] == 0x0A && i < buffersize && headendhitnum < 4)
if (i < buffersize && buffer[i] == 0x0A && headendhitnum < 4)
{
i++;
headendhitnum++;
if (buffer[i] == 0x0D && i < buffersize && headendhitnum < 4)
if (i < buffersize && buffer[i] == 0x0D && headendhitnum < 4)
{
i++;
headendhitnum++;
if (buffer[i] == 0x0A && i < buffersize && headendhitnum < 4)
if (i < buffersize && buffer[i] == 0x0A && headendhitnum < 4)
{
i++;
headendhitnum++;
Expand Down Expand Up @@ -1752,15 +1752,15 @@ void httpparse::readformfilename(const unsigned char *buffer, unsigned int buffe
if (buffer[i] == 0x0D)
{
headendhitnum = 1;
if (buffer[i + 1] == 0x0A && i < buffersize)
if ((i + 1) < buffersize && buffer[i + 1] == 0x0A)
{

headendhitnum++;
if (buffer[i + 2] == 0x0D && i < buffersize)
if ((i + 2) < buffersize && buffer[i + 2] == 0x0D)
{

headendhitnum++;
if (buffer[i + 3] == 0x0A && i < buffersize)
if ((i + 3) < buffersize && buffer[i + 3] == 0x0A)
{

headendhitnum++;
Expand All @@ -1787,7 +1787,7 @@ void httpparse::readformfilename(const unsigned char *buffer, unsigned int buffe
readoffset = i;
if (isbound == 1)
{
std::string fieldname;
//std::string fieldname;

header_temp.clear();
unsigned int jj = 0;
Expand Down Expand Up @@ -2018,20 +2018,20 @@ void httpparse::readformfielditem(const unsigned char *buffer, unsigned int buff

return;
}
if (buffer[i] == 0x0D && i < buffersize)
if (i < buffersize && buffer[i] == 0x0D)
{
i++;
}
if (buffer[i] == 0x0A && i < buffersize)
if (i < buffersize && buffer[i] == 0x0A)
{
i++;
}

readoffset = i;
return;
}

header_input.append((char *)&buffer_key[0], buffer_key.size());
//header_input.append((char *)&buffer_key[0], buffer_key.size());
header_input.append(buffer_key);
buffer_key.clear();
}
changetype = 0;
Expand Down

0 comments on commit 67e515b

Please sign in to comment.