From 13f859844cd72ea3a895d348b0e5843f13bf7338 Mon Sep 17 00:00:00 2001 From: "Xiaoyang Yu (max)" Date: Sat, 12 Apr 2014 04:01:05 +0800 Subject: [PATCH] Fix SDBD segfault issue Fix TIVI-3031 SDBD process segment fault Change-Id: Ie65d929b23f78d72dbd48ce958c4c75ec2ef7f87 Signed-off-by: Xiaoyang Yu (max) --- src/sdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sdb.c b/src/sdb.c index 0ab561a..1018430 100644 --- a/src/sdb.c +++ b/src/sdb.c @@ -1119,9 +1119,12 @@ int set_developer_privileges() { } } // TODO: use pam later - char * env = "HOME="; + char * env = malloc(strlen("HOME=") + strlen(HOME_DEV_PATH) + 1); + if(env == 0) fatal("failed to allocate for env string"); + strcpy(env, "HOME="); strcat(env, HOME_DEV_PATH); putenv(env); + free(env); return 1; } -- 2.34.1