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
This commit is contained in:
Yifan Hong
2020-07-17 12:47:45 -07:00
parent 7cac9425b0
commit 339c986606

View File

@@ -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(),