# HG changeset patch # User masneyb # Date 1163724280 0 # Node ID 0cf4d8c46b82f6f795f6c186a5cfa60c6e92a554 # Parent bcdf0759e3d0e1cbd6bb5bfbd05cf8979a6fb53a 2006-11-16 Brian Masney * lib/sshv2.c (sshv2_initialize_string_with_path) - make sure the endpos variable is pointing to the position after the string. This fixes an issue with the current CVS code where files could not be transferred. (closes #371615) diff -r bcdf0759e3d0 -r 0cf4d8c46b82 ChangeLog --- a/ChangeLog Sat Nov 04 14:07:24 2006 +0000 +++ b/ChangeLog Fri Nov 17 00:44:40 2006 +0000 @@ -1,3 +1,9 @@ +2006-11-16 Brian Masney + * lib/sshv2.c (sshv2_initialize_string_with_path) - make sure the endpos + variable is pointing to the position after the string. This fixes an + issue with the current CVS code where files could not be transferred. + (closes #371615) + 2006-11-2 Brian Masney * lib/ftpcommon.h lib/ftps.c lib/rfc959.c - use the encoded filename length to determine how many bytes should be sent in the command to the @@ -3702,7 +3708,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.497 2006/11/03 03:23:19 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.498 2006/11/17 00:44:38 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r bcdf0759e3d0 -r 0cf4d8c46b82 lib/sshv2.c --- a/lib/sshv2.c Sat Nov 04 14:07:24 2006 +0000 +++ b/lib/sshv2.c Fri Nov 17 00:44:40 2006 +0000 @@ -184,7 +184,7 @@ pathlen = strlen (str); } - *msglen = pathlen + 8; + *msglen += pathlen + 8; ret = sshv2_initialize_buffer (request, *msglen); sshv2_add_string_to_buf (ret + 4, addstr, pathlen); @@ -230,7 +230,7 @@ first_utf8 = _sshv2_generate_utf8_path (request, str1, &pathlen1); sec_utf8 = _sshv2_generate_utf8_path (request, str2, &pathlen2); - *msglen = pathlen1 + pathlen2 + 12; + *msglen += pathlen1 + pathlen2 + 12; ret = sshv2_initialize_buffer (request, *msglen); sshv2_add_string_to_buf (ret + 4, first_utf8, pathlen1); sshv2_add_string_to_buf (ret + 8 + pathlen1, sec_utf8, pathlen2); @@ -244,12 +244,15 @@ return (ret); } + static char * sshv2_initialize_string_with_path (gftp_request * request, const char *path, size_t *len, char **endpos) { char *ret, *tempstr; + size_t origlen; + origlen = *len; if (*path == '/') ret = sshv2_initialize_buffer_with_i18n_string (request, path, len); else @@ -260,7 +263,7 @@ } if (endpos != NULL) - *endpos = ret + *len; + *endpos = ret + *len - origlen; return (ret); } @@ -1038,6 +1041,7 @@ else dir = request->directory; + len = 0; tempstr = sshv2_initialize_buffer_with_i18n_string (request, dir, &len); ret = sshv2_send_command (request, SSH_FXP_REALPATH, tempstr, len); g_free (tempstr); @@ -1277,6 +1281,7 @@ request->logging_function (gftp_logging_misc, request, _("Retrieving directory listing...\n")); + msglen = 0; tempstr = sshv2_initialize_buffer_with_i18n_string (request, request->directory, &msglen); @@ -1680,6 +1685,7 @@ g_return_val_if_fail (oldname != NULL, GFTP_EFATAL); g_return_val_if_fail (newname != NULL, GFTP_EFATAL); + msglen = 0; tempstr = sshv2_initialize_buffer_with_two_i18n_paths (request, oldname, newname, &msglen); @@ -1847,7 +1853,7 @@ params = request->protocol_data; params->offset = startsize; - len = 8; + len = 8; /* For mode */ tempstr = sshv2_initialize_string_with_path (request, file, &len, &endpos); num = htonl (mode);