Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix some other Null Pointer Dereference bugs #18072

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions lib/mgmt_be_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ static int __send_notification(struct mgmt_be_client *client, const char *xpath,
int ret = 0;

assert(op != NOTIFY_OP_NOTIFICATION || xpath || tree);
assert(xpath || tree);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd at all. Why an assert is required here at all? I see it was introduced here opensourcerouting@c88b489, but maybe we can just fixup it correctly instead of adding a second assert?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this commit not have the analysis of what is being done and it's in the PR? This makes no sense and I would like the commit to have this analysis. 5 years from now people are going to be looking at the code and commit messages not the PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. How about returning an error code when both xpath and tree are null instead of using an assert?
And I'll resubmit a PR with an analysis in the commit information.

debug_be_client("%s: sending %sYANG %snotification: %s", __func__,
op == NOTIFY_OP_DS_DELETE ? "delete "
: op == NOTIFY_OP_DS_REPLACE ? "replace "
Expand Down
5 changes: 3 additions & 2 deletions lib/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,9 @@ static int lib_vrf_create(struct nb_cb_create_args *args)
return NB_OK;

vrfp = vrf_get(VRF_UNKNOWN, vrfname);

SET_FLAG(vrfp->status, VRF_CONFIGURED);

if (vrfp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should return a warning/error instead then? Also, check vrf_handler_create().

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. But I'm not sure which error code should be returned.

SET_FLAG(vrfp->status, VRF_CONFIGURED);
nb_running_set_entry(args->dnode, vrfp);

return NB_OK;
Expand Down