core: use memdup_suffix0() at one more place

This commit is contained in:
Yu Watanabe
2024-10-08 14:43:23 +09:00
parent 858eac353b
commit 9f0d2d64cc
+1 -4
View File
@@ -2411,13 +2411,10 @@ int bus_exec_context_set_transient_property(
c->log_extra_fields = t;
}
copy = malloc(sz + 1);
copy = memdup_suffix0(p, sz);
if (!copy)
return -ENOMEM;
memcpy(copy, p, sz);
((uint8_t*) copy)[sz] = 0;
if (!utf8_is_valid(copy))
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Journal field is not valid UTF-8");