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

Commit c63037cd 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 48960384
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -218,7 +218,8 @@ int get_tzn(const char *sensor_name)
            snprintf(name, MAX_PATH, TZ_TYPE, tzn);
            snprintf(name, MAX_PATH, TZ_TYPE, tzn);
            ALOGD("Opening %s\n", name);
            ALOGD("Opening %s\n", name);
            read_line_from_file(name, buf, sizeof(buf));
            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)) {
            if (!strcmp(buf, sensor_name)) {
                found = 1;
                found = 1;
                break;
                break;