aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/httpcli/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/httpcli/parser.c')
-rw-r--r--src/core/httpcli/parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c
index 7b2a62060c..404906d5ae 100644
--- a/src/core/httpcli/parser.c
+++ b/src/core/httpcli/parser.c
@@ -96,13 +96,15 @@ static int add_header(grpc_httpcli_parser *parser) {
gpr_log(GPR_ERROR, "Didn't find ':' in header string");
goto error;
}
- hdr.key = buf2str(beg, cur - beg);
+ GPR_ASSERT(cur >= beg);
+ hdr.key = buf2str(beg, (size_t)(cur - beg));
cur++; /* skip : */
while (cur != end && (*cur == ' ' || *cur == '\t')) {
cur++;
}
- hdr.value = buf2str(cur, end - cur - 2);
+ GPR_ASSERT(end - cur >= 2);
+ hdr.value = buf2str(cur, (size_t)(end - cur) - 2);
if (parser->r.hdr_count == parser->hdr_capacity) {
parser->hdr_capacity =
@@ -171,7 +173,7 @@ static int addbyte(grpc_httpcli_parser *parser, gpr_uint8 byte) {
parser->r.body =
gpr_realloc((void *)parser->r.body, parser->body_capacity);
}
- ((char *)parser->r.body)[parser->r.body_length] = byte;
+ parser->r.body[parser->r.body_length] = (char)byte;
parser->r.body_length++;
return 1;
}