r = unhexmem(rvalue, strlen(rvalue), &p, &l);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse key id. Ignoring assignment: %s", rvalue);
- return 0;
- }
- if (l > MACSEC_KEYID_LEN) {
- log_syntax(unit, LOG_ERR, filename, line, 0,
- "The size of key id is too large (%zu), maximum of %zu permitted. "
- "Ignoring assignment: %s", l, (size_t) MACSEC_KEYID_LEN, rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse KeyId \"%s\": %m", rvalue);
return 0;
}
+ if (l > MACSEC_KEYID_LEN)
+ return log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Specified KeyId is larger then the allowed maximum (%zu > %u), ignoring: %s",
+ l, MACSEC_KEYID_LEN, rvalue);
dest = a ? a->sa.key_id : b->sa.key_id;
memcpy_safe(dest, p, l);