Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion libopenarc/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,10 @@ arc_parse_header_field(ARC_MESSAGE *msg, u_char *hdr, size_t hlen,
while (end > hdr && isascii(*(end - 1)) && isspace(*(end - 1)))
end--;

/* don't allow incredibly large field names */
if (end - hdr > ARC_MAXHDRNAMELEN)
return ARC_STAT_SYNTAX;

/* don't allow a field name containing a semicolon */
semicolon = memchr(hdr, ';', hlen);
if (semicolon != NULL && colon != NULL && semicolon < colon)
Expand Down Expand Up @@ -2758,7 +2762,8 @@ arc_eoh(ARC_MESSAGE *msg)

for (h = msg->arc_hhead; h != NULL; h = h->hdr_next)
{
char hnbuf[ARC_MAXHEADER + 1];
char hnbuf[ARC_MAXHDRNAMELEN + 1];
assert(h->hdr_namelen <= ARC_MAXHDRNAMELEN);

memset(hnbuf, '\0', sizeof hnbuf);
strncpy(hnbuf, h->hdr_text, h->hdr_namelen);
Expand Down
2 changes: 2 additions & 0 deletions libopenarc/arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ extern "C" {
#define ARC_HDRMARGIN 75 /* "standard" header margin */
#define ARC_MAXHEADER 4096 /* buffer for caching one header */
#define ARC_MAXHOSTNAMELEN 256 /* max. FQDN we support */
#define ARC_MAXLINELEN 1000 /* physical line limit (RFC5321) */
#define ARC_MAXHDRNAMELEN (ARC_MAXLINELEN - 3) /* deduct ":" CRLF */

#define ARC_AR_HDRNAME "ARC-Authentication-Results"
#define ARC_DEFAULT_MINKEYSIZE 1024
Expand Down