From 35df710a1fa21b62c5328e2c98f29a68a0312a25 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sun, 7 Aug 2016 15:54:14 +0100 Subject: configfile: fix EOF handling Currently we can end up passing EOF to isspace(), which is in fact libgit's sane_isspace which does: ((sane_ctype[(unsigned char)(x)] & (GIT_SPACE)) != 0) It is very unlikely that EOF cast to "unsigned char" will end up in a character that has the GIT_SPACE bit set, but the standard only requires that EOF be a negative integer, so it could access any value in the sane_ctype array. If it does end up returning true for isspace() then this loop will never terminate, so handle EOF as a special value in the same way as the other loops in this function. Signed-off-by: John Keeping --- configfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configfile.c b/configfile.c index 5b0d880..e039109 100644 --- a/configfile.c +++ b/configfile.c @@ -39,7 +39,9 @@ static int read_config_line(FILE *f, struct strbuf *name, struct strbuf *value) /* Skip comments and preceding spaces. */ for(;;) { - if (c == '#' || c == ';') + if (c == EOF) + return 0; + else if (c == '#' || c == ';') skip_line(f); else if (!isspace(c)) break; -- cgit 1.4.1 f='/catgirl/refs/?h=somasis/tokipona&id=3359a5d69b0fe3c08812f7db83e27958ffec820f'>refs log tree commit diff
Commit message (Expand)Author
2022-02-19Enable -Wmissing-prototypesJune McEnroe
2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe
2022-02-19Run line editing testsJune McEnroe
2022-02-18Implement new line editing "library"June McEnroe
2022-02-18Simplify cursor positioning in inputJune McEnroe
2022-02-18Fix M-f orderingJune McEnroe
2022-02-12Move sandman build to scripts/MakefileJune McEnroe
2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe
2022-02-12Copy RPP defines from oconfigureJune McEnroe