For #1508, check the chunk header length.
This commit is contained in:
parent
4382ced3bf
commit
2b51cee3ef
|
|
@ -963,10 +963,15 @@ srs_error_t SrsHttpResponseReader::read_chunked(char* data, int nb_data, int* nb
|
||||||
at[length - 1] = 0;
|
at[length - 1] = 0;
|
||||||
at[length - 2] = 0;
|
at[length - 2] = 0;
|
||||||
|
|
||||||
|
// The at is length in string, it must be all digital.
|
||||||
|
if (!srs_is_digit_number(at)) {
|
||||||
|
return srs_error_new(ERROR_HTTP_INVALID_CHUNK_HEADER, "invalid length=%s", at);
|
||||||
|
}
|
||||||
|
|
||||||
// size is the bytes size, excludes the chunk header and end CRLF.
|
// size is the bytes size, excludes the chunk header and end CRLF.
|
||||||
int ilength = (int)::strtol(at, NULL, 16);
|
int ilength = (int)::strtol(at, NULL, 16);
|
||||||
if (ilength < 0) {
|
if (ilength < 0) {
|
||||||
return srs_error_new(ERROR_HTTP_INVALID_CHUNK_HEADER, "invalid length=%d", ilength);
|
return srs_error_new(ERROR_HTTP_INVALID_CHUNK_HEADER, "invalid length=%s as %d", at, ilength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// all bytes in chunk is left now.
|
// all bytes in chunk is left now.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user