[cfe-dev] RFC warn when uninitialized buffer is passed to strcat

Daniel Marjamäki Daniel.Marjamaki at evidente.se
Fri Feb 21 08:47:16 PST 2014


Hello!

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140221/9f3bf7ff/attachment.html>


More information about the cfe-dev mailing list