mu: fix strncpy usage

Ensure the resulting strings are \0-terminated.
This commit is contained in:
djcb
2018-06-11 09:18:27 +03:00
parent 088064d5e1
commit 2d954e9647
4 changed files with 14 additions and 7 deletions

View File

@ -344,7 +344,8 @@ field_string_list (MuMsg *msg, MuMsgFieldId mfid)
str = mu_str_from_list (lst, ',');
if (str) {
strncpy (buf, str, sizeof(buf));
strncpy (buf, str, sizeof(buf)-1);
buf[sizeof(buf)-1]='\0';
g_free (str);
return buf;
}