> Wouldn't this would exceed maxlen?

Yes, if `must_append` is true, then this code has the ability to exceed `maxlen` (by `strlen(expr_line)` bytes). But, as far as I can see, this was already the case in the old version of the code. That's also the reason why I kept that (admittedly strange) behaviour. I wanted to put that in the commit message, but seemingly forgot.

> Interestingly, I can't find any call to write_reg_contents_ex() nor write_reg_contents() where maxlen is not -1.

message.c, line 2556 (otherwise I would've removed it, for the complexity it introduces).