On Thu, Nov 24, 2016 at 12:01:08PM -0800, scan-admin(a)coverity.com wrote:
________________________________________________________________________________________________________
*** CID 149097: Null pointer dereferences (FORWARD_NULL)
/source-Osmocom/openbsc/openbsc/src/gprs/gprs_sndcp_comp.c: 67 in
gprs_sndcp_comp_create()
61 comp_field->rfc2507_params->nsapi,
62 sizeof(comp_entity->nsapi));
63 } else if (comp_field->rohc_params) {
64 comp_entity->nsapi_len = comp_field->rohc_params->nsapi_len;
65 memcpy(comp_entity->nsapi, comp_field->rohc_params->nsapi,
66 sizeof(comp_entity->nsapi));
>>> CID 149097: Null pointer dereferences (FORWARD_NULL)
>>> Comparing "comp_field->v42bis_params" to null implies that
"comp_field->v42bis_params" might be null.
The point of this complaint:
- gprs_sndcp_comp.c:67 implies that v42bis_params might be NULL
- on line 104 we call gprs_sndcp_dcomp_init()
- then this function (gprs_sndcp_dcomp.c near 88) dereferences
comp_field->v42bis_params without checking for NULL (instead relies on
comp_entity->algo == V42BIS)
I think I'd add an OSMO_ASSERT(comp_field->v42bis_params) in
gprs_sndcp_dcomp_init(). pmaier?
~N