Re: [evolution-patches] 4 x bugreport



On Wed, 2004-01-28 at 05:16, Jan Becvar wrote:
> Hello,
> I have discovered an "unpleasant" bug in the libical library, which is
> included in Evolution. Library sometimes frees one memory twice and then
> ends with SIGSEGV.
> 
> Function `icalmemory_append_string' reallocates string `str' (`str' can
> be moved to another location) in original source.  But initial location
> will be freed again at another libical call. Small patch follows: 
> 
> 
> --- evolution.orig/libical/src/libical/icalrecur.c Thu Oct 30 09:14:09 2003
> +++ evolution/libical/src/libical/icalrecur.c Thu Oct 30 09:15:42 2003
> @@ -475,7 +475,7 @@
>         return 0;
>      }
> 
> -    str = (char*)icalmemory_tmp_buffer(buf_sz);
> +    str = (char*)icalmemory_new_buffer(buf_sz);
>      str_p = str;
> 
>      icalmemory_append_string(&str,&str_p,&buf_sz,"FREQ=");
> @@ -545,6 +545,7 @@
>         }
>      }
> 
> +    icalmemory_add_tmp_buffer(str);
>      return  str;
>  }
>  #endif

Looks a lot safer to me.

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.




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