1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a possible stack overflow in cListBase::Sort()

This commit is contained in:
Klaus Schmidinger 2015-09-10 13:20:21 +02:00
parent 14f97d0f2a
commit 0f18bd0a6a
3 changed files with 7 additions and 2 deletions

View File

@ -714,6 +714,7 @@ Oliver Endriss <o.endriss@gmx.de>
to detect the frame type to detect the frame type
for suggesting to ignore channels with an RID that is not 0 when checking for obsolete for suggesting to ignore channels with an RID that is not 0 when checking for obsolete
channels channels
for fixing a possible stack overflow in cListBase::Sort()
Reinhard Walter Buchner <rw.buchner@freenet.de> Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf' for adding some satellites to 'sources.conf'

View File

@ -8813,3 +8813,4 @@ Video Disk Recorder Revision History
to Thomas Reufer). to Thomas Reufer).
- Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal - Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal
menus (thanks to Stefan Braun). menus (thanks to Stefan Braun).
- Fixed a possible stack overflow in cListBase::Sort() (thanks to Oliver Endriss).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 4.3 2015/09/06 10:47:05 kls Exp $ * $Id: tools.c 4.4 2015/09/10 13:17:55 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@ -2253,7 +2253,9 @@ static int CompareListObjects(const void *a, const void *b)
void cListBase::Sort(void) void cListBase::Sort(void)
{ {
int n = Count(); int n = Count();
cListObject *a[n]; cListObject **a = MALLOC(cListObject *, n);
if (a == NULL)
return;
cListObject *object = objects; cListObject *object = objects;
int i = 0; int i = 0;
while (object && i < n) { while (object && i < n) {
@ -2267,6 +2269,7 @@ void cListBase::Sort(void)
count--; count--;
Add(a[i]); Add(a[i]);
} }
free(a);
} }
// --- cHashBase ------------------------------------------------------------- // --- cHashBase -------------------------------------------------------------