Menu

uninitvar False Positive when using strcpy to initialize the data

2021-10-14
2021-10-18
  • Steve Albright

    Steve Albright - 2021-10-14

    error: uninitvar - Uninitialized variable: testData

    struct CharDataOnly
    {
       char data[100];
    };
    
    CharDataOnly uninitvarFalsePositiveExample()
    {
       CharDataOnly testData;
    
       strcpy(testData.data, "string smaller than size");
       return testData;
    }
    
     
  • CHR

    CHR - 2021-10-18

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/10553

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.