Skip to content

Wrong strncat size evaluation #4

Description

@jackdroido

The last strncat at line 44 (which copy the remainder of the string after all replacement has been applied) should be:
strncat(result, pos, strlen(pos));
instead of the current one:
strncat(result, pos, (str - pos));
where size always evaluate to a negative value (since pos >= str) which when casted to size_t (unsigned) results in a big number, leading to unpredictable strncat behaviour.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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