Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Potential memory issue in PIPE #45

@cpiber

Description

@cpiber

Please correct me if I'm wrong, but I think you have a memory issue. In

nobuild/nobuild.h

Lines 752 to 762 in 47e280e

if (fdin) {
if (dup2(*fdin, STDIN_FILENO) < 0) {
PANIC("Could not setup stdin for child process: %s", strerror(errno));
}
}
if (fdout) {
if (dup2(*fdout, STDOUT_FILENO) < 0) {
PANIC("Could not setup stdout for child process: %s", strerror(errno));
}
}
you de-reference the input fds, but in
Pipe pip = {0};
you create that on the stack, once for all of them. You overwrite them in each iteration. But afaik you are not guaranteed that the child runs and de-references those pointers before you get to the next command in the loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions