Skip to content

buffer overflow when reading strings from the targets file #14

@firmianay

Description

@firmianay

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions