eclipse-wakaama / wakaama

Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
BSD 3-Clause "New" or "Revised" License
501 stars 374 forks source link

observe_step() in observe.c does not check a return parameter of pointer type. #501

Open stefanfangvall opened 3 years ago

stefanfangvall commented 3 years ago

check (dataP == NULL): dataP can be NULL even if object_readData() returns COAP_205_CONTENT

void observe_step(lwm2m_context_t contextP, time_t currentTime, time_t timeoutP) { lwm2m_data_t * dataP = NULL . . if (COAP_205_CONTENT != object_readData(contextP, &targetP->uri, &size, &dataP)) continue;

sbertin-telular commented 3 years ago

This would only happen when observing at the object level with no instances of the object. It appears to be an issue wherever object_readData() is called.

qleisan commented 3 years ago

@sbertin-telular you made a clarifying comment, thanks. Can you elaborate a bit more? Does this require a programming error e.g. on the implementation of the targetP->readFunc for a not yet implemented object or is this an existing issue that can be shown to exist?