RFC warn when uninitialized buffer is passed to strcat


We want to add a warning when a uninitialized buffer is passed to strcat.

Code example:

void f() {

char buffer[10];

strcat(buffer, “abc”);


I don’t plan to check if the destination buffer is zero terminated or not to start with. Only if it is uninitialized or not.

We can extend the uninitialized variables checking so it will detect this. We can hardcode that the 1st parameter to “strcat” must be initialized. However as far as I know there is a BodyFarm that should have this type of knowledge. Do you think we should update the BodyFarm and use it in the check? There might be other standard functions that don’t like uninitialized buffer parameters that we could add later.

Best regards,

Daniel Marjamäki