1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

Use memcpy() instead of strncpy() to silence the compiler warning.

This commit is contained in:
Alexander Færøy 2019-02-09 22:42:13 +01:00
parent a25b4e5db2
commit 346211eeeb

View File

@ -621,8 +621,10 @@ static enum otr_msg_status enqueue_otr_fragment(const char *msg, struct otr_peer
opc->msg_size += msg_len + 1;
}
/* Copy msg to full message since we already have a part pending. */
strncpy(opc->full_msg + opc->msg_len, msg, msg_len);
/* Copy msg to full message since we already have a part pending. Note
* that we do not copy `msg`'s trailing nul byte because we explicit
* set opc->full_msg[opc->msg_len] to nul afterwards. */
memcpy(opc->full_msg + opc->msg_len, msg, msg_len);
opc->msg_len += msg_len;
opc->full_msg[opc->msg_len] = '\0';
@ -664,7 +666,7 @@ static enum otr_msg_status enqueue_otr_fragment(const char *msg, struct otr_peer
return ret;
}
/* Copy full message with NULL terminated byte. */
strncpy(opc->full_msg, msg, msg_len);
memcpy(opc->full_msg, msg, msg_len);
opc->msg_len += msg_len;
opc->msg_size += ((msg_len * 2) + 1);
opc->full_msg[opc->msg_len] = '\0';