EffectBundle: Avoid possible out-of-bounds access

'preset' is allowed to be PRESET_CUSTOM, which is -1, when we
use it as an array index in an ALOGVV statement.  We change this
logic to just use 'name' directly.  While this risks a
truncation of the string, it avoids out-of-bounds and is
probably still sufficient for debugging.

Bug: 77720605
Test: TreeHugger
Change-Id: Id03829e4ba73764ca23ed8238632ff02946cdebc
gugelfrei
Greg Kaiser 5 years ago
parent d22f3e8933
commit b9e3657ad5

@ -2686,7 +2686,7 @@ int Equalizer_getParameter(EffectContext *pContext,
name[*pValueSize - 1] = 0;
*pValueSize = strlen(name) + 1;
ALOGVV("%s EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
__func__, preset, gEqualizerPresets[preset].name, *pValueSize);
__func__, preset, name, *pValueSize);
} break;

Loading…
Cancel
Save