[OpenSIPS-Devel] [opensips] uac_registrant: avoid bulk re-registrations on large servers (#701)

Răzvan Crainea notifications at github.com
Wed Dec 16 10:21:48 CET 2015


> +		memcpy(new_rec->td.id.call_id.s, old_rec->td.id.call_id.s,
> +		    new_rec->td.id.call_id.len);
> +		memcpy(new_rec->td.id.loc_tag.s, old_rec->td.id.loc_tag.s,
> +		    new_rec->td.id.loc_tag.len);
> +		new_rec->td.loc_seq.value = old_rec->td.loc_seq.value;
> +		new_rec->last_register_sent = old_rec->last_register_sent;
> +		new_rec->registration_timeout = old_rec->registration_timeout;
> +		new_rec->state = old_rec->state;
> +	}
> +	return 0;
> +}
> +
> +int run_find_same_rec(void *e_data, void *data, void *r_data)
> +{
> +	reg_record_t *new_rec = (reg_record_t*)e_data;
> +	int i = (int*)data;

@ovidiusas could you review this a bit - while looking at the [Travis log](https://travis-ci.org/OpenSIPS/opensips/builds/97166562) I noticed this warning, which actually may lead to a bug.

`data` is a pointer to an integer, that is passed to an integer. This may be a _huge_ value, that is used below to index the `reg_htable`.

My guess is that the line should be `int i = *(int *)data;`, but please give it a look too.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/701/files#r47752264
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20151216/6fbecba2/attachment.htm>


More information about the Devel mailing list