From: Slava Barinov Date: Mon, 26 Sep 2016 15:06:29 +0000 (+0300) Subject: Fix the sdb shell malfunction in ASan build X-Git-Tag: submit/tizen/20160930.063257^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=679d5a6846cc20d290d35cc6d7b091cc3936c807;p=sdk%2Ftarget%2Fsdbd.git Fix the sdb shell malfunction in ASan build Accordingly to exec(3) manual the envp argument is an array of pointers to null-terminated strings and must be terminated by a null pointer. Without the terminator execvp fails and errno is set to 'Bad address' Change-Id: I00e6927fd62323b7a9bea918cc79b0c4e02d77fd Signed-off-by: Slava Barinov --- diff --git a/src/services.c b/src/services.c index 2fbcaa7..c3f72c1 100644 --- a/src/services.c +++ b/src/services.c @@ -653,6 +653,9 @@ static int create_subproc_thread(const char *name, int lines, int columns) } free(envp_plugin); + /* Last element of envp must be the NULL-terminator to prevent execvp fail */ + envp[envp_cnt] = NULL; + if(name) { // in case of shell execution directly // Check the shell command validation. if (!request_plugin_verification(SDBD_CMD_VERIFY_SHELLCMD, name)) {