mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
ctdb-protocol: Fix marshalling of struct ctdb_public_ip_list
There can be 0 public addresses. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
5498b71b3d
commit
5f5b3193a3
@ -1675,6 +1675,11 @@ int ctdb_public_ip_list_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
pubip_list->num = wire->num;
|
||||
if (wire->num == 0) {
|
||||
pubip_list->ip = NULL;
|
||||
*out = pubip_list;
|
||||
return 0;
|
||||
}
|
||||
pubip_list->ip = talloc_array(pubip_list, struct ctdb_public_ip,
|
||||
wire->num);
|
||||
if (pubip_list->ip == NULL) {
|
||||
|
@ -611,7 +611,11 @@ static void fill_ctdb_public_ip_list(TALLOC_CTX *mem_ctx,
|
||||
{
|
||||
int i;
|
||||
|
||||
p->num = rand_int(32) + 1;
|
||||
p->num = rand_int(32);
|
||||
if (p->num == 0) {
|
||||
p->ip = NULL;
|
||||
return;
|
||||
}
|
||||
p->ip = talloc_array(mem_ctx, struct ctdb_public_ip, p->num);
|
||||
assert(p->ip != NULL);
|
||||
for (i=0; i<p->num; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user