From: Ken Raeburn Date: Sun, 15 Oct 2006 07:49:35 +0000 (+0000) Subject: Use memmove for overlapping regions X-Git-Tag: krb5-1.6-alpha1~59 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1d041112e1c4b38c3fe2f3531637a85ce19453a7;p=krb5.git Use memmove for overlapping regions git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18703 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c index 93ace9088..c384f2471 100644 --- a/src/appl/gssftp/ftp/ftp.c +++ b/src/appl/gssftp/ftp/ftp.c @@ -693,35 +693,37 @@ int getreply(int expecteof) n = '5'; } #ifdef KRB5_KRB4_COMPAT - else if (strcmp(auth_type, "KERBEROS_V4") == 0) - if ((kerror = safe ? - krb_rd_safe((unsigned char *)ibuf, - (unsigned int) len, - &cred.session, - &hisctladdr, - &myctladdr, &msg_data) - : krb_rd_priv((unsigned char *)ibuf, - (unsigned int) len, - schedule, &cred.session, - &hisctladdr, &myctladdr, - &msg_data)) - != KSUCCESS) { - printf("%d reply %s! (krb_rd_%s: %s)\n", code, - safe ? "modified" : "garbled", - safe ? "safe" : "priv", - krb_get_err_text(kerror)); - n = '5'; - } else { - if (debug) printf("%c:", safe ? 'S' : 'P'); - if(msg_data.app_length < sizeof(ibuf) - 2) { - memcpy(ibuf, msg_data.app_data, - msg_data.app_length); + else if (strcmp(auth_type, "KERBEROS_V4") == 0) { + if (safe) + kerror = krb_rd_safe((unsigned char *)ibuf, + (unsigned int) len, + &cred.session, + &hisctladdr, + &myctladdr, &msg_data); + else + kerror = krb_rd_priv((unsigned char *)ibuf, + (unsigned int) len, + schedule, &cred.session, + &hisctladdr, &myctladdr, + &msg_data)); + if (kerror != KSUCCESS) { + printf("%d reply %s! (krb_rd_%s: %s)\n", code, + safe ? "modified" : "garbled", + safe ? "safe" : "priv", + krb_get_err_text(kerror)); + n = '5'; + } else { + if (debug) printf("%c:", safe ? 'S' : 'P'); + if(msg_data.app_length < sizeof(ibuf) - 2) { + memmove(ibuf, msg_data.app_data, + msg_data.app_length); strcpy(&ibuf[msg_data.app_length], "\r\n"); - } else { + } else { printf("Message too long!"); - } - continue; } + continue; + } + } #endif #ifdef GSSAPI else if (strcmp(auth_type, "GSSAPI") == 0) { diff --git a/src/appl/gssftp/ftp/secure.c b/src/appl/gssftp/ftp/secure.c index 52fda8cac..0998a18e4 100644 --- a/src/appl/gssftp/ftp/secure.c +++ b/src/appl/gssftp/ftp/secure.c @@ -404,7 +404,7 @@ int fd; krb_get_err_text(kerror)); return(ERR); } - memcpy(ucbuf, msg_data.app_data, msg_data.app_length); + memmove(ucbuf, msg_data.app_data, msg_data.app_length); nin = bufp = msg_data.app_length; } #endif /* KRB5_KRB4_COMPAT */