Skip to content

Commit

Permalink
Fixed buffer overrun after changing chunk size.
Browse files Browse the repository at this point in the history
Thanks to Zengxian Ding.
  • Loading branch information
arut committed May 24, 2021
1 parent afd350e commit 2f2db81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ngx_rtmp_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ ngx_rtmp_recv(ngx_event_t *rev)
"reusing formerly read data: %d", old_size);

b->pos = b->start;
b->last = ngx_movemem(b->pos, old_pos, old_size);

size = ngx_min((size_t) (b->end - b->start), old_size);
b->last = ngx_movemem(b->pos, old_pos, size);

if (s->in_chunk_size_changing) {
ngx_rtmp_finalize_set_chunk_size(s);
Expand Down

0 comments on commit 2f2db81

Please sign in to comment.