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

trust: don't create file names longer then 255 #659

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

ZoltanFridrich
Copy link
Contributor

trust extract creates file names based on CKA_LABEL attribute of trusted certificates. Some of these certificates contain labels that are longer then file name limit on linux which causes file creation to fail.
This MR makes make_unique_name to trim names that are equal or longer then 255.

@coveralls
Copy link

coveralls commented Oct 3, 2024

Coverage Status

coverage: 69.543% (+0.001%) from 69.542%
when pulling cfbadae on ZoltanFridrich:zfridric_devel
into 89d3a55 on p11-glue:master.

Copy link
Member

@ueno ueno left a comment

Choose a reason for hiding this comment

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

Do we have any assurance that the truncated filename doesn't collide with others? Perhaps we could fall back to other naming scheme, e.g., hash, if the filename would be longer than 255?

@ZoltanFridrich
Copy link
Contributor Author

Do we have any assurance that the truncated filename doesn't collide with others? Perhaps we could fall back to other naming scheme, e.g., hash, if the filename would be longer than 255?

Yes, we do. Because the name is truncated before any modifications and checks.

Copy link
Member

@ueno ueno left a comment

Choose a reason for hiding this comment

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

LGTM, looks like the uniqueness is ensured and also the generated file name ends with a NUL character. Thanks!

@ZoltanFridrich ZoltanFridrich merged commit a8b9464 into p11-glue:master Oct 4, 2024
14 checks passed
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.

3 participants