The code copies the origin string up to and including the null terminator, which must exist as strlen was used to obtain the size.
For real programs you basically have to put it in the initial computation, or it will be forgotten somewhere later (maybe in a later commit).
Mayhaps "len" should be renamed to something clearer?