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

Use monotonic clock for sequence numbering #184

Closed

Conversation

ZoltanFridrich
Copy link
Contributor

@ZoltanFridrich ZoltanFridrich commented Mar 12, 2024

Fixes the following error found by static analysis:

Error: Y2K38_SAFETY (CWE-197):
libkcapi-1.3.1/lib/kcapi-kernel-if.c:658: store_truncates_time_t: A "time_t" value is stored in an integer with too few bits to accommodate it.  The expression "time(NULL)" is cast to "__u32".
#  656|   	req.n.nlmsg_flags = NLM_F_REQUEST;
#  657|   	req.n.nlmsg_type = CRYPTO_MSG_GETALG;
#  658|-> 	req.n.nlmsg_seq = (__u32)time(NULL);
#  659|   
#  660|   	if (drivername)

@smuellerDD
Copy link
Owner

smuellerDD commented Mar 12, 2024 via email

@ZoltanFridrich
Copy link
Contributor Author

For some reason I thought that when retyping a larger type to smaller type an overflow would cause the count to stop. But of course it will continue from zero. This is a false positive. Please disregard this MR.

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