Skip to content

Commit ac4f8ea

Browse files
committed
libopenarc: work on length support
1 parent 537cc1e commit ac4f8ea

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

libopenarc/arc.c

+21-2
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,15 @@ arc_process_set(ARC_MESSAGE *msg,
17501750
}
17511751
ARC_FREE(hcopy);
17521752

1753-
/* test validity of "t", "x", and "i" */
1753+
/* test validity of "l", "t", "x", and "i" */
1754+
p = arc_param_get(set, "l");
1755+
if (p != NULL && !arc_check_uint(p, NULL))
1756+
{
1757+
arc_error(msg, "invalid \"l\" value in %s data", settype);
1758+
set->set_bad = true;
1759+
return ARC_STAT_SYNTAX;
1760+
}
1761+
17541762
p = arc_param_get(set, "t");
17551763
if (p != NULL)
17561764
{
@@ -2732,6 +2740,7 @@ arc_eoh_verify(ARC_MESSAGE *msg)
27322740
{
27332741
unsigned int n;
27342742
unsigned int hashtype;
2743+
uint64_t len;
27352744
char *c;
27362745
ARC_STAT status;
27372746
struct arc_hdrfield *h = NULL;
@@ -2819,6 +2828,16 @@ arc_eoh_verify(ARC_MESSAGE *msg)
28192828
body_canon = ARC_CANON_SIMPLE;
28202829
}
28212830

2831+
c = arc_param_get(h->hdr_data, "l");
2832+
if (c != NULL)
2833+
{
2834+
arc_check_uint(c, &len);
2835+
}
2836+
else
2837+
{
2838+
len = -1;
2839+
}
2840+
28222841
status = arc_add_canon(msg, ARC_CANONTYPE_HEADER, hdr_canon, hashtype,
28232842
htag, h, (ssize_t) -1, &msg->arc_hdrcanons[n]);
28242843

@@ -2831,7 +2850,7 @@ arc_eoh_verify(ARC_MESSAGE *msg)
28312850

28322851
/* body, validation */
28332852
status = arc_add_canon(msg, ARC_CANONTYPE_BODY, body_canon, hashtype,
2834-
NULL, NULL, (ssize_t) -1,
2853+
NULL, NULL, (ssize_t) len,
28352854
&msg->arc_bodycanons[n]);
28362855

28372856
if (status != ARC_STAT_OK)

0 commit comments

Comments
 (0)