builtin-merge.c: allocate correct amount of memory
[gitweb.git] / server-info.c
index a051e49a9ea2f605bdc278394de731ff4c55e627..c1c073b2f05a48772a45602cdc711eef6e211695 100644 (file)
@@ -101,7 +101,7 @@ static int read_pack_info_file(const char *infofile)
 
        while (fgets(line, sizeof(line), fp)) {
                int len = strlen(line);
-               if (line[len-1] == '\n')
+               if (len && line[len-1] == '\n')
                        line[--len] = 0;
 
                if (!len)