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

Miscellaneous fixes #1914

Merged
merged 3 commits into from
Aug 8, 2018
Merged

Conversation

jeromemarchand
Copy link
Contributor

This fixes a few bug uncovered by a Coverity scan: some leaks and more importantly some memory access errors.

Fixes a buffer overflow in get_pid_exe(), a use-after-free error in
bcc_usdt_get_probe_argctype() and a possible NULL pointer dereference
in find_debug_via_debuglink().
Leaked file descriptors in bpf_attach_uprobe() and verify_checksum().
Memory leaks in  Parser::func_add() and bcc_procutils_language().
@@ -446,8 +446,10 @@ const char *bcc_procutils_language(int pid) {
while (isspace(mapname[0])) mapname++;
for (i = 0; i < nb_languages; i++) {
snprintf(pathname, sizeof(pathname), "/lib%s", languages[i]);
if (strstr(mapname, pathname))
if (strstr(mapname, pathname)) {
fclose(procfile);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you correct the indentation for the above fclose(procfile)?

Copy link
Collaborator

@yonghong-song yonghong-song left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for all these fixes! Only a minor format change is needed.

@yonghong-song
Copy link
Collaborator

[buildbot, ok to test]

1 similar comment
@yonghong-song
Copy link
Collaborator

[buildbot, ok to test]

@yonghong-song
Copy link
Collaborator

[buildbot, ok to test]

1 similar comment
@yonghong-song
Copy link
Collaborator

[buildbot, ok to test]

@yonghong-song yonghong-song merged commit b84714a into iovisor:master Aug 8, 2018
@jeromemarchand jeromemarchand deleted the covscan_fixes branch August 5, 2019 16:02
CrackerCat pushed a commit to CrackerCat/bcc that referenced this pull request Jul 31, 2024
* Fix multiple memory access errors

Fixes a buffer overflow in get_pid_exe(), a use-after-free error in
bcc_usdt_get_probe_argctype() and a possible NULL pointer dereference
in find_debug_via_debuglink().

* Fix multiple ressource leaks

Leaked file descriptors in bpf_attach_uprobe() and verify_checksum().
Memory leaks in  Parser::func_add() and bcc_procutils_language().

* fixup! Fix multiple ressource leaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants