hal: audio_extn: fix speaker protection initial cal issue
In get_tzn function, buf pointer is overriden as empty string
due to wrong index name used when assigning null terminator.
Fix the issue by using correct index name.
Change-Id: Iae418aa72a852d66dc64bdfb90a4600e40f8cae6
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index e703b13..8601a7e 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -214,7 +214,7 @@
snprintf(name, MAX_PATH, TZ_TYPE, tzn);
ALOGD("Opening %s\n", name);
read_line_from_file(name, buf, sizeof(buf));
- buf[strlen(sensor_name)] = '\0';
+ buf[strlen(buf)] = '\0';
if (!strcmp(buf, sensor_name)) {
found = 1;
break;