From 62b35962ee6acf67bbbf3235818a1bafa1ec1d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20K=C3=A1roly=20G=C3=A1briel?= Date: Tue, 27 Oct 2015 10:47:30 +0000 Subject: [PATCH] cmd_wrapper: fix libc support see Note Note: at least musl-libc and newer glibc stick to standards and consider setenv(..., NULL, ...) UB as per http://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html We choose this fix because it mimics old behaviour of glibc, but the real fix would be to not call at all setenv with NULL second parameter. Musl relevant mail thread: http://www.openwall.com/lists/musl/2015/04/23/1 --- src/tools-source/cmd_wrapper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tools-source/cmd_wrapper.c b/src/tools-source/cmd_wrapper.c index 1948047..b4d3874 100644 --- a/src/tools-source/cmd_wrapper.c +++ b/src/tools-source/cmd_wrapper.c @@ -3,7 +3,7 @@ * This copyright note is auto-generated by ./scripts/Create-CopyPatch. * * Filename: src/tools-source/cmd_wrapper.c - * Copyright (C) 2013 The OpenSDE Project + * Copyright (C) 2013 - 2015 The OpenSDE Project * Copyright (C) 2004 - 2006 The T2 SDE Project * Copyright (C) 1998 - 2003 Clifford Wolf * @@ -281,7 +281,14 @@ int main(int argc, char ** argv) { } else { other = strtok(other, ":"); - setenv(ENVPREFIX "_WRAPPER_OTHERS_DONE", other, 1); + if ( other == NULL ) + { + setenv(ENVPREFIX "_WRAPPER_OTHERS_DONE", "", 1); + } + else + { + setenv(ENVPREFIX "_WRAPPER_OTHERS_DONE", other, 1); + } } }