mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
fix: a few off by one errors in group autotests
Since we're nul terminating these buffers they need one extra byte
This commit is contained in:
parent
5c093c4888
commit
203e1af81e
|
@ -19,13 +19,13 @@
|
||||||
#define GROUP_NAME_LEN (sizeof(GROUP_NAME) - 1)
|
#define GROUP_NAME_LEN (sizeof(GROUP_NAME) - 1)
|
||||||
|
|
||||||
typedef struct Peer {
|
typedef struct Peer {
|
||||||
char name[TOX_MAX_NAME_LENGTH];
|
char name[TOX_MAX_NAME_LENGTH + 1];
|
||||||
size_t name_length;
|
size_t name_length;
|
||||||
uint32_t peer_id;
|
uint32_t peer_id;
|
||||||
} Peer;
|
} Peer;
|
||||||
|
|
||||||
typedef struct State {
|
typedef struct State {
|
||||||
char self_name[TOX_MAX_NAME_LENGTH];
|
char self_name[TOX_MAX_NAME_LENGTH + 1];
|
||||||
size_t self_name_length;
|
size_t self_name_length;
|
||||||
|
|
||||||
uint32_t group_number;
|
uint32_t group_number;
|
||||||
|
|
|
@ -179,7 +179,7 @@ static int check_group_state(const Tox *tox, uint32_t groupnumber, uint32_t peer
|
||||||
if (password != nullptr && my_pass_len > 0) {
|
if (password != nullptr && my_pass_len > 0) {
|
||||||
ck_assert(my_pass_len <= TOX_GROUP_MAX_PASSWORD_SIZE);
|
ck_assert(my_pass_len <= TOX_GROUP_MAX_PASSWORD_SIZE);
|
||||||
|
|
||||||
uint8_t my_pass[TOX_GROUP_MAX_PASSWORD_SIZE];
|
uint8_t my_pass[TOX_GROUP_MAX_PASSWORD_SIZE + 1];
|
||||||
tox_group_get_password(tox, groupnumber, my_pass, &query_err);
|
tox_group_get_password(tox, groupnumber, my_pass, &query_err);
|
||||||
my_pass[my_pass_len] = 0;
|
my_pass[my_pass_len] = 0;
|
||||||
ck_assert_msg(query_err == TOX_ERR_GROUP_STATE_QUERIES_OK, "Failed to get password: %d", query_err);
|
ck_assert_msg(query_err == TOX_ERR_GROUP_STATE_QUERIES_OK, "Failed to get password: %d", query_err);
|
||||||
|
@ -199,7 +199,7 @@ static int check_group_state(const Tox *tox, uint32_t groupnumber, uint32_t peer
|
||||||
|
|
||||||
ck_assert(my_gname_len <= TOX_GROUP_MAX_GROUP_NAME_LENGTH);
|
ck_assert(my_gname_len <= TOX_GROUP_MAX_GROUP_NAME_LENGTH);
|
||||||
|
|
||||||
uint8_t my_gname[TOX_GROUP_MAX_GROUP_NAME_LENGTH];
|
uint8_t my_gname[TOX_GROUP_MAX_GROUP_NAME_LENGTH + 1];
|
||||||
tox_group_get_name(tox, groupnumber, my_gname, &query_err);
|
tox_group_get_name(tox, groupnumber, my_gname, &query_err);
|
||||||
my_gname[my_gname_len] = 0;
|
my_gname[my_gname_len] = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user