Skip to content

Commit

Permalink
Use safe_strcpy and safe_strcat
Browse files Browse the repository at this point in the history
Fixes two warnings found by Coverity in #2996
  • Loading branch information
weirddan455 committed Oct 14, 2023
1 parent 904cb68 commit c556a70
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/shell/shell_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ void DOS_Shell::CMD_COPY(char* args)

if (!search_result.IsDirectory()) {
safe_strcpy(nameSource, pathSource);
strcat(nameSource, search_result.name.c_str());
safe_strcat(nameSource, search_result.name.c_str());
// Open Source
if (DOS_OpenFile(nameSource,0,&sourceHandle)) {
// Create Target or open it if in concat mode
Expand Down Expand Up @@ -1506,8 +1506,7 @@ static bool attrib_recursive(DOS_Shell *shell,
std::string(1, '\\') +
get_filename(args);
found_dirs.push_back(fullname);
strcpy(path, fullname.c_str());
*(path + len) = 0;
safe_strcpy(path, fullname.c_str());
}
} while (DOS_FindNext());
all_dirs.insert(all_dirs.begin() + 1,
Expand Down

0 comments on commit c556a70

Please sign in to comment.