Skip to content

Remove use for strlen from native code #4975

Description

Remove and or replace the use for strlen from native code

Activity

  1. added this to the milestone on Oct 2, 2017
  2. SteveL-MSFT commented on Oct 3, 2017

    @SteveL-MSFT
    Member

    Mike Richmond (@mirichmo) can you take this one?

  3. mirichmo commented on Oct 12, 2017

    @mirichmo
    Member

    I've been looking into it and the use of strlen seems appropriate in this case. From MSDN, "strnlen is not a replacement for strlen; strnlen is intended to be used only to calculate the size of incoming untrusted data in a buffer of known size—for example, a network packet"

    It is used twice within ...\src\powershell-native\nativemsh\CssMainEntry.cpp. One invocation of it calculates the length of a hardcoded string that is guaranteed to be null terminated. The other invocation calculates the length of a string passed in as a command-line argument. In the second instance, we do not know the length of the incoming string so it would introduce a bug to artificially guess the value.

  4. TravisEz13 commented on Oct 12, 2017

    @TravisEz13
    MemberAuthor

    this is not an appropriate resolution. This issue is 'must fix'. Please speak with me before closing.

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

Metadata

Metadata

Labels

ComplianceRelated to compliance requirementsWG-Maintainers-Buildspecific to affecting the build

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions