Fix crash issue when scim_get_home_dir() is called 89/168889/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 1 Feb 2018 02:19:36 +0000 (11:19 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 1 Feb 2018 02:26:35 +0000 (02:26 +0000)
Change-Id: I033b2a193c1cfe4f367c788c46626f565aab29e2

ism/src/scim_utility.cpp

index ef08d1b..441f274 100644 (file)
@@ -653,9 +653,12 @@ scim_get_home_dir ()
     char buf [2048] = {0,};
 
     setpwent ();
-    getpwuid_r (getuid (), &pw, buf, sizeof (buf), &result);
+    int ret = getpwuid_r (getuid (), &pw, buf, sizeof (buf), &result);
     endpwent ();
 
+    if (ret != 0 || !result)
+        return String ("");
+
     if (result && pw.pw_dir) {
         home_dir = pw.pw_dir;
     } else {