mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
stack protection (CAN-2005-0087)
From Thierry Vignaud <tvignaud@mandrakesoft.com>: from rh: stack protection control (see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=144518)
This commit is contained in:
parent
1dd2db1367
commit
e02c51a199
1 changed files with 2 additions and 5 deletions
|
|
@ -520,17 +520,14 @@ static int snd_mixer_compare_default(const snd_mixer_elem_t *c1,
|
|||
return c1->class->compare(c1, c2);
|
||||
}
|
||||
|
||||
typedef int (*qsort_func)(const void *, const void *);
|
||||
static int snd_mixer_sort(snd_mixer_t *mixer)
|
||||
{
|
||||
unsigned int k;
|
||||
int compar(const void *a, const void *b) {
|
||||
return mixer->compare(*(const snd_mixer_elem_t * const *) a,
|
||||
*(const snd_mixer_elem_t * const *) b);
|
||||
}
|
||||
assert(mixer);
|
||||
assert(mixer->compare);
|
||||
INIT_LIST_HEAD(&mixer->elems);
|
||||
qsort(mixer->pelems, mixer->count, sizeof(snd_mixer_elem_t*), compar);
|
||||
qsort(mixer->pelems, mixer->count, sizeof(snd_mixer_elem_t*), (qsort_func)mixer->compare);
|
||||
for (k = 0; k < mixer->count; k++)
|
||||
list_add_tail(&mixer->pelems[k]->list, &mixer->elems);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue