Marc Balmer said:
> It's one more hack that works around the real problem.  We begin
> to add tests to make sure indices are not negative instead of solving
> the real problem, i.e. to make sure those indices are not negative in
> the first place.
> 
> The patch is ok for me, as a temporary hack, but I think we should
> really go deeper into matters, find out why the indices are wrong and
> submit patches upstream.

Not really - the real problem is the order of the expression is
incorrect (it's too late to check !j once you've used it), and this 
looks like a correct fix, doing what the author's logic intended.
OK to commit, alek
 
> >+--- src/conf.c.orig Sat Aug 27 22:54:54 2005
> >++++ src/conf.c      Sat Aug 27 22:54:27 2005
> >+@@ -157,7 +157,7 @@ gint            get_conf(gchar *key, t_conf *conf)
> >+   for (i = 0; conf->file_content[i]; i++)
> >+     for (j = 0; conf->file_content[i][j]; j++)
> >+       if (conf->file_content[i][j] == COMMENT &&
> >+-     (conf->file_content[i][j - 1] != '\\' || !j))
> >++     (!j || conf->file_content[i][j - 1] != '\\'))
> >+    {
> >+      conf->file_content[i][j] = '\0';
> >+      break;

Reply via email to