Skip to content

Conversation

@flowerysong
Copy link
Contributor

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 field name length in arc_parse_header_field() seems reasonable, and prevents malformed headers from overrunning this buffer.

`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.
@futatuki
Copy link

According to RFC 5322 section 2.1.1. each line of characters MUST be no more than 998 characters, and from the description about field name section 2.2. filed names cannot be folded.

So we can use lesser limit value than ARC_MAXHEADER for the restriction arc_parse_header_field() for enforcing RFC5322 section 2.1.1. (and can reduce the size of buffers for header field name, if we need to do so).

futatuki added a commit to futatuki/OpenARC that referenced this pull request Sep 16, 2024
…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
futatuki added a commit to futatuki/OpenARC that referenced this pull request Sep 18, 2024
…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
@flowerysong flowerysong deleted the arc_maxheader branch October 16, 2024 18:52
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