buffer overflow when reading strings from the targets file
firmianay opened this issue · 0 comments
firmianay commented
hi, great project!
There is a stack overflow in the process_append function of the program because the length of the string read in the targets file is not checked. And the same problem exists in process_prepend.
void process_append()
{
for (auto append = append_list.begin(); append != append_list.end(); ++append)
{
if (!(std::find(exclude_list.begin(), exclude_list.end(), *target) != exclude_list.end()))
{
string appnd = *append;
// First level
char a[1024] = {};
strncpy(a, targ.c_str(), location);
strcat(a, "-");
char temp[1024] = {};
strncpy(temp, appnd.c_str(), appnd.length());
strcat(a, temp);
strcat(a, targ.substr(location, targ.length() - location).c_str());
print_domain(string(a));
$ ./DNScewl --tL target.txt -a append.txt
[2022-07-07 14:33:27.345] [info]
...
[1] 1370 segmentation fault ./DNScewl --tL target.txt -a append.txt