Skip to content

Commit

Permalink
Prevent technically unsafe access with empty vector
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorycu authored and nerzhul committed Jan 3, 2016
1 parent a7c50a3 commit 87dcee6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/network/networkpacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ void NetworkPacket::putRawString(const char* src, u32 len)
m_data.resize(m_datasize);
}

if (m_datasize == 0)
return;

memcpy(&m_data[m_read_offset], src, len);
m_read_offset += len;
}
Expand Down

0 comments on commit 87dcee6

Please sign in to comment.