mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Protect against null strings in hal wrapper implementation.
Some HALs may provide null pointers in lieu of empty strings. Avoid simple copies of these strings. Bug: 35384551 Test: Verify affected device (Pixel-C) boots and auto-rotate works. Change-Id: I37ab6e781d6dfdcc1667bcc0467690f7c2c9a557
This commit is contained in:
@@ -25,8 +25,8 @@ namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
void convertFromSensor(const sensor_t &src, SensorInfo *dst) {
|
||||
dst->name = src.name;
|
||||
dst->vendor = src.vendor;
|
||||
dst->name = src.name == nullptr ? "" : src.name;
|
||||
dst->vendor = src.vendor == nullptr ? "" : src.vendor;
|
||||
dst->version = src.version;
|
||||
dst->sensorHandle = src.handle;
|
||||
dst->type = (SensorType)src.type;
|
||||
@@ -36,8 +36,8 @@ void convertFromSensor(const sensor_t &src, SensorInfo *dst) {
|
||||
dst->minDelay = src.minDelay;
|
||||
dst->fifoReservedEventCount = src.fifoReservedEventCount;
|
||||
dst->fifoMaxEventCount = src.fifoMaxEventCount;
|
||||
dst->typeAsString = src.stringType;
|
||||
dst->requiredPermission = src.requiredPermission;
|
||||
dst->typeAsString = src.stringType == nullptr ? "" : src.stringType;
|
||||
dst->requiredPermission = src.requiredPermission == nullptr ? "" : src.requiredPermission;
|
||||
dst->maxDelay = src.maxDelay;
|
||||
dst->flags = src.flags;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user