Stanislav Tihohod
2007-Aug-21 09:41 UTC
[Samba] Segment violation during the list of directory with smbc_readdir
Dear samba,
I have a small piece of code that crashes on Samba 3.0.5:
int main()
{
int smbdh;
struct smbc_dirent *smbdi;
char *smb_url = "smb://SERVER/Archive/NOT EMPTY";
if(smbc_init(get_auth, 0) < 0)
{
fprintf(stderr, "error initializing libsmbclient: %s\n",
strerror(errno));
return -1;
}
if((smbdh = smbc_opendir(smb_url)) < 1)
{
fprintf(stderr,"Unable to open directory: %s",
strerror(errno));
return -1;
}
while((smbdi = smbc_readdir(smbdh)) != NULL)
{
fprintf(stderr, "%s\n", smbdi->name);
}
printf("DONE\n");
return 0;
}
The listed folder contains a file with a very long Japanese name.
The next call of smbc_readdir after this file is listed crashes:
.
..
New Text Document.txt
sdfsdf
????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?????-T??L?v-????--?L?
Segmentation fault
I have updated samba to 3.0.25b and now my sample does not crash.
Is it a fixed bug in the old Samba? I could not find any records
about fixing of smbc_readdir in the WHATSNEW.txt file.
Thank you.
--
Best regards,
Stanislav mailto:tihohod@alarity.com
Volker Lendecke
2007-Aug-21 09:48 UTC
[Samba] Segment violation during the list of directory with smbc_readdir
On Tue, Aug 21, 2007 at 01:30:27PM +0400, Stanislav Tihohod wrote:> Dear samba, > > I have a small piece of code that crashes on Samba 3.0.5:Can you please retry this against 3.0.25c? Thanks, Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20070821/c44bd9e3/attachment.bin
Stanislav Tihohod
2007-Aug-21 10:43 UTC
[Samba] Segment violation during the list of directory with smbc_readdir
Dear Volker, As I said in the previous letter, no crash occurs against 3.0.25b. The problem is that Samba 3.0.5 is used in a product that is currently in production. So I need to have a proof that this bug is in Samba and is fixed in a newer version. Could anybody help, please? Tuesday, August 21, 2007, 1:49:15 PM, you wrote: VL> On Tue, Aug 21, 2007 at 01:30:27PM +0400, Stanislav Tihohod wrote:>> Dear samba, >> >> I have a small piece of code that crashes on Samba 3.0.5:VL> Can you please retry this against 3.0.25c? VL> Thanks, VL> Volker -- Best regards, Stanislav mailto:tihohod@alarity.com
Volker Lendecke
2007-Aug-21 10:54 UTC
[Samba] Segment violation during the list of directory with smbc_readdir
On Tue, Aug 21, 2007 at 02:43:06PM +0400, Stanislav Tihohod wrote:> As I said in the previous letter, no crash occurs against 3.0.25b. > The problem is that Samba 3.0.5 is used in a product that is > currently in production. So I need to have a proof that this bug > is in Samba and is fixed in a newer version. > Could anybody help, please?Well, it will be difficult to get support for such an old version for free on the mailing lists. See http://samba.org/samba/support for companies doing commercial support for Samba. And if you have 3.0.5 in a product, just look at the source code and see where it crashes. Standard debugging, compile with -g and run it under valgrind to get a backtrace with line number information. You should be able to quickly nail and fix it. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20070821/feaa923b/attachment.bin