adrian-thurston / colm

The Colm Programming Language
MIT License
164 stars 31 forks source link

Fix out-of-bounds memcpy #137

Closed viccie30 closed 2 years ago

viccie30 commented 2 years ago

memcpy in string_alloc_full was copying 32 bytes, while the string is only 25 bytes including the terminating null byte.

Also, since this is a string literal, there is no need to actually copy it. Just allocating a head is enough if I'm reading the code correctly. This was also found by building with LTO enabled.

viccie30 commented 2 years ago

Thanks for the review! I'll make the changes tomorrow and push them.

viccie30 commented 2 years ago

I've force pushed the changes you requested. Please let me know if it needs more work.