mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #1508, check the chunk header length.
This commit is contained in:
parent
4382ced3bf
commit
2b51cee3ef
1 changed files with 6 additions and 1 deletions
|
@ -963,10 +963,15 @@ srs_error_t SrsHttpResponseReader::read_chunked(char* data, int nb_data, int* nb
|
|||
at[length - 1] = 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.
|
||||
int ilength = (int)::strtol(at, NULL, 16);
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue