Re: Problem in the foobar widget.



On Tue, 19 Sep 2000, George wrote:

> 
> On Tue, Sep 19, 2000 at 05:12:09PM -0400, Matthew Berg wrote:
> > There is a bug in gnome-core 1.2.1, in panel/foobar-widget.c. 
> > 
> > The problem is that the return on strftime isn't being checked properly,
> > resulting in an undefined string being assigned to hour, e.g.
> 
> 
> This is fixed in HEAD and in the 1.2.2 that's coming soon (hopefully).  The
> way it now works is:
> 
>   char hour[256];
> 
>   if(strftime(hour, sizeof(hour), _("%A %B %d"), das_tm) == 0) {
>   	/* according to docs, if the string does not fit, the
>    	* contents of tmp2 are undefined, thus just use
>    	* ??? */
>   	strcpy(hour, "???");
>   }
>   hour[sizeof(hour)-1] = '\0'; /* just for sanity */
> 
> This will work even with broken strftime which does return max, though you
> may get weird things (but no crash).

Glad to hear its fixed, and in a more sane way than I had :) To be honest,
I was mostly just curious what was causing it, and noticed the problem.
 
> Thanks for the report though

Not a probem. :) Might want to clear out the entries in the bug
database. Somehow, I thought to check that and not CVS.

In any case, the relevant tracking numbers are 25145, 24497 and 24466.

Matt





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