Fix SDBD segfault issue 09/19409/1 accepted/tizen_generic accepted/tizen_ivi_release tizen_ivi_release accepted/tizen/generic/20140415.185303 accepted/tizen/ivi/release/20140412.070515 submit/tizen/20140411.235043 submit/tizen_ivi_release/20140412.063036
authorXiaoyang Yu (max) <max.a.yu@intel.com>
Fri, 11 Apr 2014 20:01:05 +0000 (04:01 +0800)
committerXiaoyang Yu (max) <max.a.yu@intel.com>
Fri, 11 Apr 2014 20:01:05 +0000 (04:01 +0800)
Fix TIVI-3031 SDBD process segment fault

Change-Id: Ie65d929b23f78d72dbd48ce958c4c75ec2ef7f87
Signed-off-by: Xiaoyang Yu (max) <max.a.yu@intel.com>
src/sdb.c

index 0ab561a53242d0a619f6ee22c6deeb62923e3136..1018430a4c5b4567925df18d2c1e0b509d48a71d 100644 (file)
--- 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;
 }