Skip to content

postreceive: fix the problem that getEnvVar may panic

bojun.cbj requested to merge cbj/gitaly:master into master

The input passed to the getEnvVar() is not controllable. For example, when the input env string is "foo" and the value of key is also "foo", then getEnvVar() will cause panic exception because the parsed array is out of range.

When the array length of the parsed env string is less than 2 then it is skipped directly because incorrect KV format should be considered invaild. Also added unit test for getEnvVar().

Changelog: fixed

Signed-off-by: Chen Bojun bojun.cbj@gmail.com

Merge request reports