/* Find an ID first, in order of preference from more specific to less specific: IMAGE_ID -> ID */
id = strv_find_first_field((char *const *)field_ids[type], fields);
+ if (id && string_has_cc(id, /* ok= */ NULL)) {
+ log_debug("os-release file '%s' contains control characters in the ID field, skipping.",
+ release->name);
+ id = NULL;
+ }
/* Then the version, same logic, prefer the more specific one */
version = strv_find_first_field((char *const *)field_versions[type], fields);
+ if (version && string_has_cc(version, /* ok= */ NULL)) {
+ log_debug("os-release file '%s' contains control characters in the version field, skipping.",
+ release->name);
+ version = NULL;
+ }
/* If there's no valid version to be found, simply omit it. */
if (!id && !version)