If the strncpy gets the exact length of destination,
null character can be missed.
To fix up this, null character setting explicitly is added.
Change-Id: I8537e53df5e82e63a46898363003d9734bcd731f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
if (!ret)
throw std::runtime_error("Not enough memory");
- for (size_t i = 0; i < subsessions.size(); ++i)
+ for (size_t i = 0; i < subsessions.size(); ++i) {
strncpy(ret[i], subsessions[i].c_str(), SUBSESSION_USER_MAXLEN);
+ ret[i][SUBSESSION_USER_MAXLEN - 1] = '\0';
+ }
*subsession_count = subsessions.size();
*subsession_list = ret;