From 6d8f274edc773425d2ef0693aabf0479cfc10336 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 12 Oct 2015 19:44:07 +0900 Subject: Fix prevent issues CIDs : 458538 Change-Id: I96f1637cb446a24a6f01886437f59a8b66f50866 Signed-off-by: jinwoo.shin --- src/square_view.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/square_view.c b/src/square_view.c index 9fd29e5..76f99e6 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -78,19 +78,23 @@ static void _print_user_message(struct _priv *priv) { char *message; uid_t uid; - struct passwd *passwd; - char buf[128]; + struct passwd pwd, *result; + char buf[128], str[128]; message = vconf_get_str(KEY_USER_MESSAGE); if (!message) { uid = getuid(); - passwd = getpwuid(uid); - if (passwd) { - snprintf(buf, sizeof(buf), + getpwuid_r(uid, &pwd, buf, sizeof(buf), &result); + if (result) + snprintf(str, sizeof(str), STR_DEFAULT_USER_MESSAGE, - passwd->pw_name); - message = buf; - } + pwd.pw_name); + else + snprintf(str, sizeof(str), + STR_DEFAULT_USER_MESSAGE, + ""); + + message = str; } elm_object_part_text_set(priv->base, PART_INFO_USER_MESSAGE, message); -- cgit v1.2.3