Added check on directory in Local_Storage::file_exists

Added check on directory in Local_Storage::file_exists.
Added check in get_filenames_recursive if last char is the path separator (some use cases were adding a path separator even if there were already one).

In base.h, added check on s and r, that will avoid an out-of-range vector exception on Visual Studio, same for network.cpp.
This commit is contained in:
Nemirtingas
2019-06-17 23:08:23 +02:00
parent b093ca90d3
commit e54072918f
3 changed files with 15 additions and 4 deletions

View File

@ -379,7 +379,10 @@ unsigned int receive_buffer_amount(sock_t sock)
static void send_tcp_pending(struct TCP_Socket &socket)
{
int len = send(socket.sock, &(socket.send_buffer[0]), socket.send_buffer.size(), MSG_NOSIGNAL);
size_t buf_size = socket.send_buffer.size();
if (buf_size == 0) return;
int len = send(socket.sock, &(socket.send_buffer[0]), buf_size, MSG_NOSIGNAL);
if (len <= 0) return;
socket.send_buffer.erase(socket.send_buffer.begin(), socket.send_buffer.begin() + len);