[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG in ltdl.c - here's a PATCH

From: Simon White
Subject: Re: BUG in ltdl.c - here's a PATCH
Date: Sat, 15 Jun 2002 04:40:48 -0500

Who ever it concerns,

>   strncpy (filename, dir_name, sizeof (filename) - 1);
>   filename[sizeof (filename) - 1] = 0;
> Dan
> > From: Lutz Müller <address@hidden>
> > 
> > memset (filename, 0, sizeof (filename));
> > strncpy (filename, dir_name, sizeof (filename) - 1);
> > 

*Cough*.  You cannot use sizeof on the filename.  It's a pointer and will give 
you the sizeof the pointer, not the string.

After checking the length of the buffer and deciding it's not big enough you 
reallocate the buffer.  Once the new buffer allocates successfully it will be 
the correct size, so just use strcpy as the check prevents overruns.


Sign-up for your own FREE Personalized E-mail at

Save up to $160 by signing up for NetZero Platinum Internet service.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]