usbus_fmt: assert descr len matches claimed len
This commit adds runtime assertions to validate that the total length of the configuration descriptor as communicated to the host device matches the generated length of the configuration descriptor.
This commit is contained in:
parent
2f74d9d644
commit
cd25e1c011
@ -260,6 +260,7 @@ size_t usbus_fmt_descriptor_conf(usbus_t *usbus)
|
||||
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&conf, sizeof(conf));
|
||||
len += _fmt_descriptors_post(usbus, usbus->descr_gen);
|
||||
len += _fmt_descriptors_ifaces(usbus);
|
||||
assert(len == conf.total_length);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user