summaryrefslogtreecommitdiff
path: root/utils/utf8.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-11 23:29:55 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-11 23:29:55 +0100
commitd3ddb39102f6763d892179b1bda9bde46b10d24a (patch)
tree612255b1fd2a83e3efe6aaa6ca2dcbe3f9f94850 /utils/utf8.c
parent39b0393d31a86a8fcfa770ad040207ace95bde0d (diff)
downloadnetsurf-d3ddb39102f6763d892179b1bda9bde46b10d24a.tar.gz
netsurf-d3ddb39102f6763d892179b1bda9bde46b10d24a.tar.bz2
fix possible missing null termination (coverity 1195410 and 1195411 )
Diffstat (limited to 'utils/utf8.c')
-rw-r--r--utils/utf8.c6
1 files changed, 3 insertions, 3 deletions
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;
}