Skip to content

test-wrappers: Copy strings that might come from getenv()

Simon McVittie requested to merge smcv/dbus:test-defend-getenv into master

It is not safe to assume that the result of getenv() is not invalidated by a subsequent call to setenv(), and #240 (closed) demonstrates that this can be a problem in practice when running Windows code under Wine.

Closes: #240 (closed)


This depends on and includes !73 (merged) because I don't want to fix this in different ways in several places, and there are some subtleties to how we need to fix it (I think the memory leak checking means we can't use a non-const DBusString, or _dbus_strdup()).

Work in progress: before merging this, someone needs to check that it actually solves #240 (closed) (I hope it will).

Edited by Simon McVittie

Merge request reports