diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-10 15:34:02 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-10 15:34:02 -0800 |
commit | 296c7bb8fa9711f580a01a7d61482f8240cba55d (patch) | |
tree | 125947259bea54ecb238624dde22e0c29dbdb799 /src/core/lib | |
parent | 5ffd766a5eddfd2ed43cb088d1ee40e2b3623303 (diff) |
Fix metadata validation
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/surface/validate_metadata.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/lib/surface/validate_metadata.c b/src/core/lib/surface/validate_metadata.c index 8c11345c65..7ec9137265 100644 --- a/src/core/lib/surface/validate_metadata.c +++ b/src/core/lib/surface/validate_metadata.c @@ -73,8 +73,11 @@ grpc_error *grpc_validate_header_key_is_legal(grpc_slice slice) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xff, 0x03, 0x00, 0x00, 0x00, 0x80, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - if (GRPC_SLICE_LENGTH(slice) == 0 || GRPC_SLICE_START_PTR(slice)[0] == ':') { - return 0; + if (GRPC_SLICE_LENGTH(slice) == 0) { + return GRPC_ERROR_CREATE("Metadata keys cannot be zero length"); + } + if (GRPC_SLICE_START_PTR(slice)[0] == ':') { + return GRPC_ERROR_CREATE("Metadata keys cannot start with :"); } return conforms_to(slice, legal_header_bits, "Illegal header key"); } |