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

libopenarc: Check length of header field name tightly. #179

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

futatuki
Copy link

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.

flowerysong and others added 3 commits December 11, 2018 20:36
`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
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