]> source.dussan.org Git - gitea.git/commitdiff
Fix crash following ldap authentication update (#16447) (#16449)
authorzeripath <art27@cantab.net>
Fri, 16 Jul 2021 00:17:47 +0000 (01:17 +0100)
committerGitHub <noreply@github.com>
Fri, 16 Jul 2021 00:17:47 +0000 (20:17 -0400)
Backport #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>
models/login_source.go

index 74341c1e99a60ee25760c4ba6e2351a04b7d5a34..23778eedc2114b34b62e206a8e50ba526af36f5e 100644 (file)
@@ -73,9 +73,9 @@ var (
 // possible that a Blob may gain an unwanted prefix of 0xff 0xfe.
 func jsonUnmarshalIgnoreErroneousBOM(bs []byte, v interface{}) error {
        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 {
-               err = json.Unmarshal(bs[2:], &v)
+               err = json.Unmarshal(bs[2:], v)
        }
        return err
 }