On Wed, 25 Apr 2007, Kostas Georgiou wrote:
> On Wed, Apr 25, 2007 at 11:07:59AM +0200, Maarten Litmaath wrote:
>
> > Ronald Starink wrote:
> >
> > >[root@boszwijn root]# rpm -qa | egrep '^vdt_globus_(sdk|essentials)'
> > >vdt_globus_essentials-VDT1.2.2rh9_LCG-3
> > >vdt_globus_sdk-VDT1.2.2rh9_LCG-3
> > >
> > >but unfortunately the server still crashes:
> > >
> > >Program received signal SIGSEGV, Segmentation fault.
> > >[Switching to Thread 37338032 (LWP 6196)]
> > >0x00acfc85 in readdir64_r@@GLIBC_2.2 () from /lib/tls/libc.so.6
> > >(gdb) where
> > >#0 0x00acfc85 in readdir64_r@@GLIBC_2.2 () from /lib/tls/libc.so.6
> > >#1 0x00f93dbd in gridmapdir_newlease (
> > > encodedglobusidp=0xb74e49c0
> > >"%2fo%3ddutchgrid%2fo%3dusers%2fo%3dnikhef%2fcn%3dronald%20starink",
> > >usernameprefix=0xb7516b18 "dteam") at gridmap.c:255
> >
> > OK, I have an idea: "struct dirent" on your system may be larger than
> > on the host where the rpm was compiled... :-(
I meant to say the max. length of the d_name field may be larger.
> You need to allocate space for the struct with something like:
> struct dirent *buffer;
> size = dirent_buf_size(gridmapdirstream);
> buffer = (struct dirent *)malloc(size);
> you aren't supposed to use the struct without allocating enough space
> for it.
>
> Have a look at:
> http://seclists.org/fulldisclosure/2005/Nov/0001.html
> for the dirent_buf_size function and the reason why you can not just
> use something like:
> pathmax = pathconf("foo", _PC_NAME_MAX);
> buffer = (struct dirent *)malloc(offsetof(struct dirent, d_name) + pathmax + 1);
Since we have plenty of memory, what do you think of this:
char buf[sizeof(struct dirent) + PATH_MAX + 1];
Thanks,
Maarten
|