mirror of git://git.sysmocom.de/ofono
gatchat: Avoid string overflow warning in debug function
This commit is contained in:
parent
dff595671b
commit
8bc6aa9880
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue