Re: [PATCH] Use strbuf for reading configuration files

2013-06-04 Thread Jason A. Donenfeld
On Tue, Jun 4, 2013 at 7:40 PM, Jason A. Donenfeld wrote: > Implementing the git_config_parse_parameter as we speak! Standby. Just sent some general sketch of what I have in mind if you'd like to try your hand with it. ___ CGit mailing list CGit@lists

Re: [PATCH] Use strbuf for reading configuration files

2013-06-04 Thread Jason A. Donenfeld
It looks like we can also borrow routines directly from git, off of which it appears config.c was initial based: http://git.zx2c4.com/git/tree/config.c In fact, what about reworking our config in general to use git's system? This would involve supporting both our: repo.blah = val syntax as well

Re: [PATCH] Use strbuf for reading configuration files

2013-06-04 Thread Jason A. Donenfeld
Looks mostly okay. While you're at it, what about fixing the BUG mentioned at the bottom of cgitrc.5.txt? ___ CGit mailing list CGit@lists.zx2c4.com http://lists.zx2c4.com/mailman/listinfo/cgit

Re: [PATCH] Use strbuf for reading configuration files

2013-06-04 Thread Lukas Fleischer
On Tue, Jun 04, 2013 at 04:47:53PM +0200, Lukas Fleischer wrote: > Use struct strbuf from Git instead of fixed-size buffers to remove the > limit on the length of configuration file lines and refactor > read_config_line() to improve readability. > > Note that this also fixes a buffer overflow that

[PATCH] Use strbuf for reading configuration files

2013-06-04 Thread Lukas Fleischer
Use struct strbuf from Git instead of fixed-size buffers to remove the limit on the length of configuration file lines and refactor read_config_line() to improve readability. Note that this also fixes a buffer overflow that existed with the original fixed-size buffer implementation. Signed-off-by

Re: configfile.c:63:14: warning: array subscript is above array [-Warray-bounds]

2013-06-04 Thread Lukas Fleischer
On Tue, Jun 04, 2013 at 12:34:49PM +0200, Jason A. Donenfeld wrote: > Here is the function in question: > > [...] > > I'll adjust it to this: > > static int read_config_line(FILE *f, char *line, const char **value, > int bufsize) > { > [...] > } else if (c == '\n' || c == EOF) {

Re: configfile.c:63:14: warning: array subscript is above array [-Warray-bounds]

2013-06-04 Thread Jason A. Donenfeld
Here is the function in question: static int read_config_line(FILE *f, char *line, const char **value, int bufsize) { int i = 0, isname = 0; *value = NULL; while (i < bufsize - 1) { int c = next_char(f); if (!isname && (c == '#' || c == ';')