#55 decmain.cpp: 2 * possible unterminated strings ?

v1.0 (example)
open
nobody
None
5
2014-05-11
2014-05-11
dcb
No

[decmain.cpp:122]: (error) Dangerous usage of 'infile_name' (strncpy doesn't always null-terminate it).
[decmain.cpp:128]: (error) Dangerous usage of 'outfile_data' (strncpy doesn't always null-terminate it).

Source code is

strncpy(infile_name, iname, sizeof(infile_name));

strncpy(outfile_data, oname, sizeof(outfile_data));

if ((ifp = fopen (infile_name, "rb")) ==NULL)
{
    perror(iname);
    return;
}

if ((fpdata = fopen (outfile_data, "wb")) ==NULL)

Suggest properly terminate the two strings before calling fopen.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks