_libssh2_packet_add: SSH_MSG_IGNORE skip memmove

There's no promise of a zero termination of the data in the callback so
no longer perform ugly operation in order to provide it.
This commit is contained in:
Daniel Stenberg 2010-11-09 14:57:36 +01:00
parent 16f46c1cfc
commit 075ff19574

View File

@ -528,12 +528,9 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
break;
case SSH_MSG_IGNORE:
if (datalen >= 5) {
/* Back it up one and add a trailing NULL */
memmove(data, data + 1, datalen - 1);
data[datalen] = '\0';
if (datalen >= 2) {
if (session->ssh_msg_ignore) {
LIBSSH2_IGNORE(session, (char *) data + 4, datalen - 1);
LIBSSH2_IGNORE(session, (char *) data + 1, datalen - 1);
}
} else if (session->ssh_msg_ignore) {
LIBSSH2_IGNORE(session, "", 0);