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

chansrv-fuse Fix cppcheck 1.89+1.90 warnings #1481

Merged
merged 1 commit into from
Feb 18, 2020

Conversation

matt335672
Copy link
Member

@matt335672 matt335672 commented Jan 16, 2020

This PR addresses the cppcheck warning generated by cppcheck for xrdp/xrdp_{xfs,fuse}.c and devredir.c mentioned in #1473

The warning in chansrv_fuse.c generated by cppcheck 1.90 (but not 1.89 or 1.82) appears to be a regression in cppcheck which has already been reported - see cppcheck TRAC 9292 and 9437. Following a realloc() failure, a free() of the original region results in a false positive.

cppcheck allows for false positives to be flagged with specially formed comments. The --inline-suppr command-line flag is needed to enable these. This approach has been taken for this file.

The warning in devredir.c appears to be valid code used to generate a random number if /dev/urandom is unavailable. I've simply replaced the code with a call to g_random() in this case.

So despite the warnings, no actual bugs have been found here.

Update: After #1487 was merged, the warning which had previously been generated for chansrv_xfs.c has now gone. This file has been removed from the original PR.

tui64 u64 = (tui64) (tintptr) &s;
u.clientID = (tui32) u64;
}
g_random((char *) &clientID, sizeof(clientID));
Copy link
Member

Choose a reason for hiding this comment

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

Good catch. It is good to use existing wrapper function.

@matt335672
Copy link
Member Author

Updated following commit of #1487 to devel branch. Header comment also updated.

@metalefty metalefty merged commit b859457 into neutrinolabs:devel Feb 18, 2020
@matt335672 matt335672 deleted the cppc-chansrv-fuse branch March 3, 2020 08:51
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