0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-13 21:41:16 +01:00

Fix crash following ldap authentication update (#16447)

Unfortunately #16268 contained a terrible error, whereby there was a double
indirection taken when unmarshalling the source data. This fatally breaks
authentication configuration reading.

Fix #16342

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
zeripath 2021-07-16 01:17:51 +01:00 committed by GitHub
parent e417cca777
commit fdb0e82148
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,9 +74,9 @@ var (
// possible that a Blob may gain an unwanted prefix of 0xff 0xfe. // possible that a Blob may gain an unwanted prefix of 0xff 0xfe.
func jsonUnmarshalIgnoreErroneousBOM(bs []byte, v interface{}) error { func jsonUnmarshalIgnoreErroneousBOM(bs []byte, v interface{}) error {
json := jsoniter.ConfigCompatibleWithStandardLibrary json := jsoniter.ConfigCompatibleWithStandardLibrary
err := json.Unmarshal(bs, &v) err := json.Unmarshal(bs, v)
if err != nil && len(bs) > 2 && bs[0] == 0xff && bs[1] == 0xfe { if err != nil && len(bs) > 2 && bs[0] == 0xff && bs[1] == 0xfe {
err = json.Unmarshal(bs[2:], &v) err = json.Unmarshal(bs[2:], v)
} }
return err return err
} }