The question can be reduce to "who do the length validation".
In my case, if i write a public-facing API, i never trust the caller will do the correct thing, thus the caller must provide all the critical parameters, and i must validate all of them.
At the boundary where untrusted input becomes trusted. This is commonly known as the sanitisation/validation layer.
The question can be reduce to "who do the length validation".
At the boundary where untrusted input becomes trusted. This is commonly known as the sanitisation/validation layer.