On Tue, May 05, 2009 at 08:12:41AM +0900, Naofumi Yasufuku wrote:
> I've updated lftp from (very old) 3.5.6 to the latest 3.7.13
> on my FreeBSD box, and found that sftp directory listing
> does't work correctly if sftp:charset is set.

Please try this patch.

> I think, utf8_to_lc(na->longname) call can replace "name" content
> before copying by "new FileInfo(name)".

You are right, utf8_to_lc clobbered tmp buffer.

-- 
   Alexander..
Index: SFtp.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/SFtp.cc,v
retrieving revision 1.83
diff -u -p -r1.83 SFtp.cc
--- SFtp.cc     16 Apr 2009 14:10:56 -0000      1.83
+++ SFtp.cc     5 May 2009 07:04:38 -0000
@@ -606,8 +606,7 @@ void SFtp::SendRequest()
         SetError(NOT_SUPP);
         break;
       }
-      char *file1_wire_path=alloca_strdup(WirePath(file1));
-      SendRequest(new Request_RENAME(WirePath(file),file1_wire_path,
+      SendRequest(new Request_RENAME(WirePath(file),WirePath(file1),
                        
SSH_FXF_RENAME_NATIVE,protocol_version),Expect::DEFAULT);
       state=WAITING;
       break;
@@ -1927,7 +1926,7 @@ const char *SFtp::utf8_to_lc(const char 
    int len;
    recv_translate->Get(&s,&len);
    recv_translate->Skip(len);
-   return s;
+   return xstring::get_tmp(s,len);
 }
 const char *SFtp::lc_to_utf8(const char *s)
 {
@@ -1940,7 +1939,7 @@ const char *SFtp::lc_to_utf8(const char 
    int len;
    send_translate->Get(&s,&len);
    send_translate->Skip(len);
-   return s;
+   return xstring::get_tmp(s,len);
 }
 
 FileSet *SFtp::GetFileSet()

Reply via email to