Skip to content
Snippets Groups Projects
Commit 0b00589a authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #27201: libiax: don't pass out of bounds pointer to memmove (minbuf)

parent 4a33c93e
No related branches found
No related tags found
No related merge requests found
...@@ -256,8 +256,10 @@ static void history_calc_maxbuf(jitterbuf *jb) ...@@ -256,8 +256,10 @@ static void history_calc_maxbuf(jitterbuf *jb)
for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) { for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
/* found where it fits */ /* found where it fits */
if (toins < jb->hist_minbuf[j]) { if (toins < jb->hist_minbuf[j]) {
/* move over */ /* move over if there's space */
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0])); const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0]);
if (slide > 0)
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, slide);
/* insert */ /* insert */
jb->hist_minbuf[j] = toins; jb->hist_minbuf[j] = toins;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment