mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #1011 from ahf/otr-compiler-warning-fix
Use memcpy() instead of strncpy() to silence the compiler warning.
This commit is contained in:
commit
ea41726b3e
@ -621,8 +621,10 @@ static enum otr_msg_status enqueue_otr_fragment(const char *msg, struct otr_peer
|
|||||||
opc->msg_size += msg_len + 1;
|
opc->msg_size += msg_len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy msg to full message since we already have a part pending. */
|
/* Copy msg to full message since we already have a part pending. Note
|
||||||
strncpy(opc->full_msg + opc->msg_len, msg, msg_len);
|
* 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->msg_len += msg_len;
|
||||||
opc->full_msg[opc->msg_len] = '\0';
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
/* Copy full message with NULL terminated byte. */
|
/* 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_len += msg_len;
|
||||||
opc->msg_size += ((msg_len * 2) + 1);
|
opc->msg_size += ((msg_len * 2) + 1);
|
||||||
opc->full_msg[opc->msg_len] = '\0';
|
opc->full_msg[opc->msg_len] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user