Re: New Defects reported by Coverity Scan for Osmocom
On Thu, Nov 24, 2016 at 12:01:08PM -0800, scan-admin@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
Hallo Neels,
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?
I am ok with that, but I think this CID is a false alarm anyway. I have now added OSMO_ASSERT()s for both gprs_sndcp_dcomp_init() and gprs_sndcp_pcomp_init(). See also: https://gerrit.osmocom.org/1279 regards, Philipp -- Philipp Maier <pmaier@sysmocom.de> http://www.sysmocom.de/ ======================================================================= * sysmocom - systems for mobile communications GmbH * Alt-Moabit 93 * 10559 Berlin, Germany * Sitz / Registered office: Berlin, HRB 134158 B * Geschaeftsfuehrer / Managing Director: Harald Welte
participants (2)
-
Neels Hofmeyr -
Philipp Maier