[Geany-devel] configuration save: utils_build_path?

Dimitar Zhekov dimitar.zhekov at xxxxx
Sun Apr 10 10:16:26 UTC 2011

On Sun, 10 Apr 2011 10:22:36 +1000
Lex Trotman <elextr at gmail.com> wrote:

> On 10 April 2011 03:48, Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:
> >
> > What is the reason for configuration_save() and
> > configuration_save_default_session() to use g_strconcat() instead of
> > utils_build_path()? [...]
> The problem is that utils_build_path is *waaaaay* unsafe, it re-uses a
> single buffer so it can't be called again before the caller has
> finished with the result, unless the caller copies the result.

I know, my question was is there a known conflict...

> [...]
> utils_build_path is really a bomb waiting to explode in someone's face
> (well code anyway :-).  It shouldn't be a general util, either it
> should be made safe or if some part of Geany uses enough paths that it
> really is a material overhead to allocate and deallocate buffers then
> it should be made a local function there, not a general util.

+1. On a second thought, +10.

> The configuration_save* functions are called from lots of places, if
> any of them have used utils_build_path then configuration_save* can't,
> so best they don't.

Only 2 places for configuration_save() (3 with x11 session management),
and 1 for configuration_save_default_session(), and all seem safe.
Comparing with the load functions, perhaps the reason is that saves use
configfile twice, with a lot of function calls between.

E-gards: Jimmy

More information about the Devel mailing list