Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00ebf142 authored by Laxminath Kasam's avatar Laxminath Kasam Committed by Gerrit - the friendly Code Review server
Browse files

hal: audio_extn: add proper check to append null terminator

To append null terminator, add proper check and use correct
string length address.

Change-Id: I1716182a16d85f78de60b3435a2b54e9e05339cd
parent a55b4b5e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -214,7 +214,8 @@ int get_tzn(const char *sensor_name)
            snprintf(name, MAX_PATH, TZ_TYPE, tzn);
            ALOGD("Opening %s\n", name);
            read_line_from_file(name, buf, sizeof(buf));
            buf[strlen(buf)] = '\0';
            if (strlen(buf) > 0)
                buf[strlen(buf) - 1] = '\0';
            if (!strcmp(buf, sensor_name)) {
                found = 1;
                break;