mirror of
https://github.com/topjohnwu/system_properties.git
synced 2024-11-26 21:40:31 +00:00
Ensure prop has zero padding
This prevents undesirable behavior if apps directly reads prop info from devfs node.
This commit is contained in:
parent
6663caac22
commit
cabe129f54
@ -300,10 +300,10 @@ int SystemProperties::Update(prop_info* pi, const char* value, unsigned int len)
|
||||
uint32_t serial = atomic_load_explicit(&pi->serial, memory_order_relaxed);
|
||||
serial |= 1;
|
||||
atomic_store_explicit(&pi->serial, serial, memory_order_relaxed);
|
||||
strlcpy(pi->value, value, len + 1);
|
||||
strncpy(pi->value, value, PROP_VALUE_MAX);
|
||||
if (have_override) {
|
||||
atomic_store_explicit(&override_pi->serial, serial, memory_order_relaxed);
|
||||
strlcpy(override_pi->value, value, len + 1);
|
||||
strncpy(override_pi->value, value, PROP_VALUE_MAX);
|
||||
}
|
||||
// Now the primary value property area is up-to-date. Let readers know that they should
|
||||
// look at the property value instead of the backup area.
|
||||
|
Loading…
Reference in New Issue
Block a user