Some fixes

This commit is contained in:
WolverinDEV 2019-09-14 12:06:45 +02:00
parent cdc64658cd
commit 316afd9f56
3 changed files with 17 additions and 8 deletions

View File

@ -518,11 +518,21 @@ i_group_modify_power,
b_virtualserver_token_add,
b_virtualserver_token_use,
b_virtualserver_token_delete,
/* ban functions */
b_client_ban_create,
b_client_ban_create_global,
b_client_ban_list_global,
b_client_ban_list,
b_client_ban_edit,
b_client_ban_edit_global,
b_client_ban_name,
b_client_ban_ip,
b_client_ban_hwid,
b_virtualserver_servergroup_list,
b_virtualserver_servergroup_client_list,
b_virtualserver_channelgroup_list,
@ -571,9 +581,6 @@ i_group_modify_power,
b_channel_modify_temp_delete_delay,
i_client_poke_power,
b_client_ban_list_global,
b_client_ban_list,
b_client_remoteaddress_view,
i_client_music_play_power,

View File

@ -146,7 +146,7 @@ namespace str_obf {
std::uint64_t rng_seed = internal::time_seed() ^ internal::string_hash(_str_seed, 0) ^ line_number;
std::uint64_t rng_base = rng_seed;
constexpr size_t key_length = generate_key_length(internal::time_seed() ^ (line_number << 37), max_size);
constexpr size_t key_length = generate_key_length(internal::time_seed() ^ (line_number << 37UL), max_size);
std::array<uint8_t, key_length> result{};
for(auto& it : result)
it = (internal::rng32_next(rng_base, rng_seed) >> 16UL) & 0xFFUL;
@ -156,7 +156,7 @@ namespace str_obf {
template <typename message>
struct decode_helper {
const message& encoded;
std::array<typename message::_char_t, message::_size + 1> buffer{0};
std::array<typename message::_char_t, message::_size> buffer{0};
bool decoded = false; /* a trivial check which (if this only gets used once) the compiler could evaluate */
#ifndef _MSC_VER /* else if you call string_view() or string() it wound inline this method */
@ -171,7 +171,6 @@ namespace str_obf {
typename message::_char_t,
typename message::_key_t
>((typename message::_char_t*) &this->buffer[0], message::_size, this->encoded.key);
buffer[message::_size] = 0; /* append the null terminator at the end */
this->decoded = true;
}
@ -179,10 +178,10 @@ namespace str_obf {
}
inline std::string_view string_view() noexcept {
return {this->c_str(), message::_size};
return {this->c_str(), message::_size - 1};
}
inline std::string string() { return {this->c_str(), message::_size}; }
inline std::string string() { return {this->c_str(), message::_size - 1}; }
//operator const char*() noexcept { return this->c_str(); }
};

View File

@ -168,11 +168,14 @@ namespace ts {
}
inline std::unique_ptr<threads::Future<bool>>& getListener() { return this->listener; }
inline size_t length() const { return this->_buffer.length(); }
inline const pipes::buffer_view mac() const { return this->_buffer.view(0, MAC_SIZE); }
inline pipes::buffer mac() { return this->_buffer.range(0, MAC_SIZE); }
inline size_t mac_length() const { return MAC_SIZE; }
inline const pipes::buffer_view header() const { return this->_buffer.view(MAC_SIZE, this->_header_length); }
inline pipes::buffer header() { return this->_buffer.range(MAC_SIZE, this->_header_length); }
inline size_t header_length() const { return this->_header_length; }
inline size_t data_length() const { return this->_buffer.length() - (MAC_SIZE + this->_header_length); }
inline const pipes::buffer_view data() const { return this->_buffer.view(MAC_SIZE + this->_header_length); }