Menu

cppcheck not detected buffer overFlow error

2024-07-08
2024-07-09
  • amany balawna

    amany balawna - 2024-07-08

    Hi everyone,

    I have a buffer overFolw error in my code,but cppcheck didn't detect it. I'm using version 2.14.1.
    here is the part of my code with buffer overFlow issue:

    char buffer[100];
    if(fread(buffer,1,100,file) != 100){
    //return error message
    }
    // continue using the buffer variable without adding "\0" at the end

    I ran the command:

    cppcheck --enable=all --inconclusive files_path.cpp

    any suggestion on why cppcheck missed this error? and who can make him focus in such this issue
    Thancks!

     
  • CHR

    CHR - 2024-07-09

    How is cppcheck supposed to know if the buffer is supposed to be null-terminated manually?

     

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.