Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Fix possible null pointer access in assert calls. #105

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/libNsdl/src/sn_grs.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ extern int8_t sn_grs_delete_resource(struct grs_s *handle, uint16_t pathlen, uin
extern int8_t sn_grs_update_resource(struct grs_s *handle, sn_nsdl_dynamic_resource_parameters_s *res)
{
/* Local variables */
assert(res->static_resource_parameters != NULL);

sn_nsdl_dynamic_resource_parameters_s *resource_temp = NULL;

if( !res || !handle ){
return SN_NSDL_FAILURE;
}

assert(res->static_resource_parameters != NULL);

/* Search resource */
resource_temp = sn_grs_search_resource(handle,
res->static_resource_parameters->pathlen,
Expand Down Expand Up @@ -331,12 +331,12 @@ extern int8_t sn_grs_update_resource(struct grs_s *handle, sn_nsdl_dynamic_resou

extern int8_t sn_grs_create_resource(struct grs_s *handle, sn_nsdl_dynamic_resource_parameters_s *res)
{
assert(res->static_resource_parameters != NULL);

if (!res || !handle) {
return SN_NSDL_FAILURE;
}

assert(res->static_resource_parameters != NULL);

/* Check path validity */
if (!res->static_resource_parameters->pathlen || !res->static_resource_parameters->path) {
return SN_GRS_INVALID_PATH;
Expand Down
2 changes: 0 additions & 2 deletions source/libNsdl/src/sn_nsdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,6 @@ int8_t sn_nsdl_build_registration_body(struct nsdl_s *handle, sn_coap_hdr_s *mes

resource_temp_ptr = sn_grs_get_first_resource(handle->grs);

assert(resource_temp_ptr->static_resource_parameters != NULL);

/* Loop trough all resources */
while (resource_temp_ptr) {
/* if resource needs to be registered */
Expand Down