Replace broken str* functions with safe versions.

This commit is contained in:
Erik de Castro Lopo
2013-03-19 20:23:44 +11:00
parent 15a011c43d
commit 2d6354ff2a
11 changed files with 96 additions and 61 deletions

View File

@@ -31,6 +31,7 @@
#include <string.h>
#include "share/alloc.h"
#include "share/safe_str.h"
#include "utf8.h"
#include "charset.h"
@@ -298,7 +299,7 @@ static int convert_string(const char *fromcode, const char *tocode,
s = safe_malloc_add_2op_(fromlen, /*+*/1);
if (!s)
return -1;
strcpy(s, from);
safe_strncpy(s, from, fromlen + 1);
*to = s;
for (; *s; s++)
if (*s & ~0x7f)