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

Re: So you think you are (or wanna be) a hacker



On Wed, Aug 11, 2004 at 08:23:21PM -0700, William Ballard wrote:
> On Thu, Aug 12, 2004 at 10:59:36AM +0800, John Summerfield wrote:
> > 	configfile = malloc(strlen(getenv("HOME")) + 20);
> > 	sprintf(configfile,"%s/%s",getenv("HOME"), cfgfile);
> 
> The length of HOME could increase between invocations.  I don't fancy 
> myself a very good C programmer, so I piped up.

No, it couldn't because env-vars are only stored in process memory (they
work just like argv-vectors). But,

* Why is strlen(cfgfile) always <= 18?

* It's very ugly (atleast to me.)



Reply to: