Don't crash fast-import if the marks cannot be exported.
[gitweb.git] / config.c
index b6082f597c118d75a9342d1e0bf5788c7a8257ee..c08c66890f0162fe69452927c48d6835178ed12d 100644 (file)
--- a/config.c
+++ b/config.c
@@ -661,6 +661,11 @@ int git_config_set_multivar(const char* key, const char* value,
                                goto out_free;
                        }
                        c = tolower(c);
+               } else if (c == '\n') {
+                       fprintf(stderr, "invalid key (newline): %s\n", key);
+                       free(store.key);
+                       ret = 1;
+                       goto out_free;
                }
                store.key[i] = c;
        }