-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Changes from all commits
ae79019
91a704c
ad70a68
e2511de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,7 +137,7 @@ static void pullwr_resize(struct pullwr *pullwr, size_t need) | |
} | ||
|
||
niov = pullwr_iov(pullwr, iov); | ||
if (niov >= 1) { | ||
if (newbuf && niov >= 1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This NULL check is superfluous. For |
||
memcpy(newbuf, iov[0].iov_base, iov[0].iov_len); | ||
if (niov >= 2) | ||
memcpy(newbuf + iov[0].iov_len, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -944,8 +944,8 @@ 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should return a warning/error instead then? Also, check There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
andtree
are null instead of using an assert?And I'll resubmit a PR with an analysis in the commit information.