Accessing memory outside of allocated boundaries caused segmentation fault.
Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
et->texts = tplg_calloc(heap, sizeof(char *) * ec->items);
if (!et->texts)
return -ENOMEM;
- for (i = 0; ec->items; i++) {
+ for (i = 0; i < ec->items; i++) {
unsigned int j = i * sizeof(int) * ENUM_VAL_SIZE;
et->texts[i] = ec->texts[i];
et->values[i] = (int *)&ec->values[j];