diff options
author | Ken Raeburn <raeburn@mit.edu> | 2006-10-15 07:49:35 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2006-10-15 07:49:35 +0000 |
commit | 1d041112e1c4b38c3fe2f3531637a85ce19453a7 (patch) | |
tree | d1a7fd3238eeeebad0d253d495169644e3601ca3 /src | |
parent | 0929211b2aeaa604daf352e05233e2e7b72350fc (diff) | |
download | krb5-1d041112e1c4b38c3fe2f3531637a85ce19453a7.zip krb5-1d041112e1c4b38c3fe2f3531637a85ce19453a7.tar.gz krb5-1d041112e1c4b38c3fe2f3531637a85ce19453a7.tar.bz2 |
Use memmove for overlapping regions
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18703 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/appl/gssftp/ftp/ftp.c | 54 | ||||
-rw-r--r-- | src/appl/gssftp/ftp/secure.c | 2 |
2 files changed, 29 insertions, 27 deletions
diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c index 93ace90..c384f24 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 52fda8c..0998a18 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 */ |