summaryrefslogtreecommitdiffstats
path: root/hal/audio_extn/spkr_protection.c
diff options
context:
space:
mode:
Diffstat (limited to 'hal/audio_extn/spkr_protection.c')
-rw-r--r--hal/audio_extn/spkr_protection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 44ff952d..54063f13 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -96,6 +96,7 @@
#define WSA_ANALOG_MODE_CHANNELS 2
#define MAX_PATH (256)
+#define MAX_STR_SIZE (1024)
#define THERMAL_SYSFS "/sys/class/thermal"
#define TZ_TYPE "/sys/class/thermal/thermal_zone%d/type"
#define TZ_WSA "/sys/class/thermal/thermal_zone%d/temp"
@@ -967,7 +968,7 @@ static void get_spkr_prot_thermal_cal(char *param)
ALOGE("%s: failed to open cal file\n", __func__);
status = -EINVAL;
}
- sprintf(param, "SpkrCalStatus: %d; R0: %lf, %lf; T0: %lf, %lf",
+ snprintf(param, MAX_STR_SIZE - strlen(param) - 1, "SpkrCalStatus: %d; R0: %lf, %lf; T0: %lf, %lf",
status, dr0[SP_V2_SPKR_1], dr0[SP_V2_SPKR_2],
dt0[SP_V2_SPKR_1], dt0[SP_V2_SPKR_2]);
ALOGD("%s:: param = %s\n", __func__, param);
@@ -1091,7 +1092,7 @@ static void get_spkr_prot_ftm_param(char *param)
ftm_status[i] = -EINVAL;
}
}
- sprintf(param, "SpkrParamStatus: %d, %d; Rdc: %lf, %lf; Temp: %lf, %lf;"
+ snprintf(param, MAX_STR_SIZE - strlen(param) - 1, "SpkrParamStatus: %d, %d; Rdc: %lf, %lf; Temp: %lf, %lf;"
" Freq: %lf, %lf; Rect: %lf, %lf; Qmct: %lf, %lf",
ftm_status[SP_V2_SPKR_1], ftm_status[SP_V2_SPKR_2],
rdc[SP_V2_SPKR_1], rdc[SP_V2_SPKR_2], temp[SP_V2_SPKR_1],