So, we probably have to duplicate the size in the memset:

```
memset(tmp, 0, sizeof(tmp[0]) * (max_length + 1));
```