From 66fc633833b2a63d47d01938c216e9cff532e333 Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Thu, 16 Oct 2014 10:37:23 +0300 Subject: [PATCH] system-controller: fix user name handling. Change-Id: I72d95e3e3c052394ca5a35170bc718dfc1ace6bf --- src/plugins/system-controller/user/user.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/system-controller/user/user.c b/src/plugins/system-controller/user/user.c index 0cc22d5..0b37764 100644 --- a/src/plugins/system-controller/user/user.c +++ b/src/plugins/system-controller/user/user.c @@ -316,11 +316,18 @@ static char *get_last_user(const char *user_dir) last_user_file = fopen(last_user_file_buf, "r"); if (last_user_file) { - ret = fread(last_user_buf, sizeof(last_user_buf), 1, last_user_file); + + memset(last_user_buf, 0, sizeof(last_user_buf)); + + ret = fread(last_user_buf, 1, sizeof(last_user_buf), last_user_file); if (ret < 0) { goto end; } + else if (ret == 512) { + /* too much data */ + goto end; + } mrp_log_info("system-controller: last user '%s'", last_user_buf); -- 2.7.4