#include <Elementary.h>
#include "elm_priv.h"
+static char *
+_str_ncpy(char *dest, const char *src, size_t count)
+{
+ if ((!dest) || (!src)) return NULL;
+ return strncpy(dest, src, count);
+}
+
static char *
_str_append(char *str, const char *txt, int *len, int *alloc)
{
ttag = malloc(tag_end - tag_start);
if (ttag)
{
- strncpy(ttag, tag_start + 1, tag_end - tag_start - 1);
+ _str_ncpy(ttag, tag_start + 1, tag_end - tag_start - 1);
ttag[tag_end - tag_start - 1] = 0;
if (!strcmp(ttag, "br"))
str = _str_append(str, "\n", &str_len, &str_alloc);
if (ts)
{
const char *esc;
- strncpy(ts, esc_start, esc_end - esc_start);
+ _str_ncpy(ts, esc_start, esc_end - esc_start);
ts[esc_end - esc_start] = 0;
esc = evas_textblock_escape_string_get(ts);
if (esc)
ts = malloc(p - s + 1);
if (ts)
{
- strncpy(ts, s, p - s);
+ _str_ncpy(ts, s, p - s);
ts[p - s] = 0;
str = _str_append(str, ts, &str_len, &str_alloc);
free(ts);
ts = malloc(p - s + 1);
if (ts)
{
- strncpy(ts, s, p - s);
+ _str_ncpy(ts, s, p - s);
ts[p - s] = 0;
str = _str_append(str, ts, &str_len, &str_alloc);
free(ts);
ts = malloc(p - s + 1);
if (ts)
{
- strncpy(ts, s, p - s);
+ _str_ncpy(ts, s, p - s);
ts[p - s] = 0;
str = _str_append(str, ts, &str_len, &str_alloc);
free(ts);
{
char tstr[16];
- strncpy(tstr, text + pos, pos2 - pos);
+ _str_ncpy(tstr, text + pos, pos2 - pos);
tstr[pos2 - pos] = 0;
str = _str_append(str, tstr, &str_len, &str_alloc);
}