libopenarc: Check length of header field name tightly.#179
Open
futatuki wants to merge 3 commits intotrusteddomainproject:developfrom
Open
libopenarc: Check length of header field name tightly.#179futatuki wants to merge 3 commits intotrusteddomainproject:developfrom
futatuki wants to merge 3 commits intotrusteddomainproject:developfrom
Conversation
`strncpy(hnbuf, h->hdr_text, h->hdr_namelen)` assumes that hdr_namelen will never be longer than ARC_MAXHEADER, but that assumption wasn't enforced anywhere. Enforcing the maximum header name length in arc_parse_header_field() seems reasonable, and prevents malformed headers from overrunning this buffer.
…eader `strncpy(hnbuf, h->hdr_text, h->hdr_namelen)` assumes that hdr_namelen will never be longer than ARC_MAXHEADER, but that assumption wasn't enforced anywhere. Enforcing the maximum header name length in arc_parse_header_field() seems reasonable, and prevents malformed headers from overrunning this buffer. trusteddomainproject#117
From the restriction of RFC5322 section 2.1.1 and section 2.2, length of email header field name cannot be more than 997. With this commit, we define a constant macro for it, and then apply this restriction on parsing header field. Also, reduce size of a buffer for copying header field name. * libopenarc/arc.h (ARC_MAXLINELEN, ARC_MAXHDRNAMELEN): New macros. * libopenarc/arc.c (arc_parse_header_field, ar_eoh): Use ARC_MAXHDRNAMELEN as maximum length of header field names.
futatuki
added a commit
to futatuki/OpenARC
that referenced
this pull request
Sep 18, 2024
…eader_field-check-field-name-len From the restriction of RFC5322 section 2.1.1 and section 2.2, length of email header field name cannot be more than 997. With this PR, we define a constant macro for it, and then apply this restriction on parsing header field. Also, reduce size of a buffer for copying header field name. trusteddomainproject#179
futatuki
added a commit
to futatuki/OpenARC
that referenced
this pull request
Sep 18, 2024
flowerysong
pushed a commit
to flowerysong/OpenARC
that referenced
this pull request
Oct 2, 2024
From the restriction of RFC5322 section 2.1.1 and section 2.2, length of email header field name cannot be more than 997. With this commit, we define a constant macro for it, and then apply this restriction on parsing header field. Also, reduce size of a buffer for copying header field name. * libopenarc/arc.h (ARC_MAXLINELEN, ARC_MAXHDRNAMELEN): New macros. * libopenarc/arc.c (arc_parse_header_field, ar_eoh): Use ARC_MAXHDRNAMELEN as maximum length of header field names. trusteddomainproject/OpenARC#179
60 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the restriction of RFC5322 section 2.1.1 and section 2.2, length of email header field name cannot be more than 997.
With this PR, we define a constant macro for it, and then apply this restriction on parsing header field. Also, reduce size of a buffer for copying header field name.
This PR contains PR #117.