Skip to content

git-sync panics at startup when git config contains a key with no value #1005

Closed

Description

@LemonCondor

Since 91a5cdf ("Log git configs"), git-sync can panic during startup when
git config list -z returns a configuration key without a value.

The panic is:

panic: runtime error: index out of range [1] with length 1

The affected code splits each config entry on \n and unconditionally
accesses the second element. Git can emit a key without a value as
key\0, without the \n separator.

This was reproduced with git 2.53 and the git-sync binary from the
affected commit.

Expected behavior: git-sync should continue starting and log the
configuration key.

A key without a value is kept distinct from an explicitly empty value.
The proposed fix represents the former as null in the diagnostic output.

The issue is reproducible through git configuration supplied via
include.path, a repository-local configuration, or
GIT_CONFIG_PARAMETERS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions