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

Fix input termination for pgpParsePkts #325

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Oct 2, 2024

The pgpParsePkts function needs the OpenPGP ASCII armored input to be null terminated. The librepo contains code that checks if the input is null-terminated. If it is not, the code creates a local null-terminated copy of the input.

There was a bug in the code, so it may look for a terminating null several bytes behind the input buffer. And when a null was found behind the input buffer, the termination was not done. This caused the pgpParsePkts function to process several extra characters after the input buffer. These characters are generally random and sometimes cause the pgpParsePkts function to return an error.

I hope this fixes rpm-software-management/dnf#2107

The `pgpParsePkts` function needs the OpenPGP ASCII armored input to be
null terminated. The librepo contains code that checks if the input is
null-terminated. If it is not, the code creates a local null-terminated
copy of the input.

There was a bug in the code, so it may look for a terminating null
several bytes behind the input buffer. And when a null was found behind
the input buffer, the termination was not done. This caused
the `pgpParsePkts` function to process several extra characters after
the input buffer. These characters are generally random and sometimes
cause the `pgpParsePkts` function to return an error.
@m-blaha m-blaha self-assigned this Oct 2, 2024
Copy link
Member

@m-blaha m-blaha left a comment

Choose a reason for hiding this comment

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

Great catch! This is one of those "easy to miss" errors.

@m-blaha m-blaha merged commit 1be8931 into rpm-software-management:master Oct 2, 2024
4 of 6 checks passed
@praiskup
Copy link
Member

Any plan to wrap a release?

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.

F39 Copr builders fail Mock build with: Parsing armored OpenPGP packet(s) failed
4 participants