Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

acl_profiler_test: fix undefined behaviour #196

Merged
merged 3 commits into from
Nov 7, 2022
Merged

Commits on Nov 7, 2022

  1. acl_test: remove undefined behaviour from acl_test_unsetenv()

    acl_getenv() always returns NULL, hence the undefined behaviour was
    never triggered. This looks like a debugging leftover, though assert()
    would have been the safe alternative to dereferencing a NULL pointer.
    
    Signed-off-by: Peter Colberg <peter.colberg@intel.com>
    pcolberg committed Nov 7, 2022
    Configuration menu
    Copy the full SHA
    36e82b2 View commit details
    Browse the repository at this point in the history
  2. acl_test: use _putenv_s() instead of _putenv() on Windows

    _putenv_s() is recommended over _putenv() as a more secure variant,
    though the exact benefits are not detailed. Unlike the unsafe putenv()
    on Linux, _putenv() on Windows does appear to copy its argument. Use
    _putenv_s() anyway since it provides the same interface as setenv().
    
    Signed-off-by: Peter Colberg <peter.colberg@intel.com>
    pcolberg committed Nov 7, 2022
    Configuration menu
    Copy the full SHA
    561e89c View commit details
    Browse the repository at this point in the history
  3. acl_profiler_test: fix undefined behaviour with putenv()

    The buffer passed to putenv() becomes part of the environment. It is
    the caller's responsibility to keep the buffer alive as long as the
    environment variable is not modified by a subsequent invocation.
    
    Signed-off-by: Peter Colberg <peter.colberg@intel.com>
    pcolberg committed Nov 7, 2022
    Configuration menu
    Copy the full SHA
    bc754bb View commit details
    Browse the repository at this point in the history