My favorite example is glibc implementation of `putenv` function: it first finds the '=' character and takes a temporary slice of the variable name and then employs a tortured null terminated string cope trying to allocate a string with alloca or malloc, then copies the slice there and passes the resulting null terminated string to common `setenv` implementation, then cleanups the allocated string. And there I thought: "ugh, dude, what are you doing, just pass the slice as is".

Reply via email to