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

Lukas Fleischer cgit at cryptocrack.de
Tue Jun 4 15:57:05 CEST 2013


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) {
>                         break;
>                 } else {
>                         line[i] = c;
>                 }
>                 isname = 1;
>                 i++;
>         }
>         line[i] = 0;
>         return i;
> }
> 
> Look good?

Ack. Maybe we can further improve this by using strbuf_*() instead of
fixed-size buffers?

> 
> Thanks Kent.
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit


More information about the CGit mailing list