summaryrefslogtreecommitdiff
path: root/gatchat
diff options
context:
space:
mode:
Diffstat (limited to 'gatchat')
-rw-r--r--gatchat/gatutil.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gatchat/gatutil.c b/gatchat/gatutil.c
index a2528e13..ea433bcb 100644
--- a/gatchat/gatutil.c
+++ b/gatchat/gatutil.c
@@ -67,8 +67,7 @@ void g_at_util_debug_chat(gboolean in, const char *str, gsize len,
escaped_str[0] = type;
escaped_str[1] = ' ';
- escaped_str[2] = '\0';
- escaped_str[escaped] = '\0';
+ memset(escaped_str + 2, '\0', escaped - 2);
for (escaped = 2, i = 0; i < len; i++) {
unsigned char c = str[i];
@@ -87,11 +86,11 @@ void g_at_util_debug_chat(gboolean in, const char *str, gsize len,
escaped_str[escaped++] = 'n';
break;
case 26:
- strncpy(&escaped_str[escaped], ctrlz, ctrlz_size);
+ memcpy(escaped_str + escaped, ctrlz, ctrlz_size);
escaped += ctrlz_size;
break;
case 25:
- strncpy(&escaped_str[escaped], esc, esc_size);
+ memcpy(escaped_str + escaped, esc, esc_size);
escaped += esc_size;
break;
default: