More problems with clitar.c

Richard Sharpe sharpe at ns.aus.com
Wed May 20 09:36:26 GMT 1998


Hi,

I have just noticed the following egregious code :-(

>  name = (char *)malloc(strlen(fname) + 1 + 1);
>  if (name == NULL) {
>
>     DEBUG(0, ("Failed to allocate space while setting time on file: %s", 
>fname));
>     return False;
>
>  }

This bit I introduced to allow for strings longer than pstring

>  pstrcpy(name, fname);
>  pstrcpy(fname, "\\");
>  pstrcat(fname, name);

This was in the original. It overwrites the passed in string. Shudder! 

I have also just realized that there are a bunch of places where pstrings
are used which should be dynamically allocated.

Oh well. Next week I am in Sydney and in my copious free time, I will be
fixing these problems :-(



Regards
-------
Richard Sharpe, sharpe at ns.aus.com, NIC-Handle:RJS96
NS Computer Software and Services P/L, 
Ph: +61-8-8281-0063, FAX: +61-8-8250-2080, 
Samba, Linux, Apache, Digital UNIX, AIX, Netscape, Stronghold, C, ...


More information about the samba-technical mailing list