From d3ddb39102f6763d892179b1bda9bde46b10d24a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 11 May 2014 23:29:55 +0100 Subject: fix possible missing null termination (coverity 1195410 and 1195411 ) --- utils/utf8.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'utils/utf8.c') diff --git a/utils/utf8.c b/utils/utf8.c index cc8039c85..a6282dbba 100644 --- a/utils/utf8.c +++ b/utils/utf8.c @@ -374,9 +374,9 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result) if (last_cd.cd) iconv_close(last_cd.cd); - /* and copy the to/from/cd data into last_cd */ - strncpy(last_cd.from, "UTF-8", sizeof(last_cd.from)); - strncpy(last_cd.to, encname, sizeof(last_cd.to)); + /* and safely copy the to/from/cd data into last_cd */ + snprintf(last_cd.from, sizeof(last_cd.from), "UTF-8"); + snprintf(last_cd.to, sizeof(last_cd.to), "%s", encname); last_cd.cd = cd; } -- cgit v1.2.3