From 339c986606573198e91e96a8f8ba964468c7a7be Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 17 Jul 2020 12:47:45 -0700 Subject: [PATCH] Fix segfault. Fix code that incorrectly transforms a hidl_string to String8 by using size of another field. Test: none Fixes: 161210887 Change-Id: I54a11e9beab4c825905dda37b121e1fc85658215 --- health/1.0/default/convert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/health/1.0/default/convert.cpp b/health/1.0/default/convert.cpp index 7f1e3c4c11..3680d4d000 100644 --- a/health/1.0/default/convert.cpp +++ b/health/1.0/default/convert.cpp @@ -79,7 +79,7 @@ void convertFromHealthConfig(const HealthConfig& c, struct healthd_config *hc) { hc->batteryCurrentAvgPath = android::String8(c.batteryCurrentAvgPath.c_str(), - c.batteryCurrentNowPath.size()); + c.batteryCurrentAvgPath.size()); hc->batteryChargeCounterPath = android::String8(c.batteryChargeCounterPath.c_str(),