aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorcoldWater <forsaken628@gmail.com>2024-03-19 10:20:36 +0800
committerGitHub <noreply@github.com>2024-03-19 02:20:36 +0000
commit0e183d81fc5283f9d2047472de580e4f04a046c1 (patch)
tree8f08d554fb9ed6c2f48d2e77e61f1ac348b76155 /services
parent1f0d31ce8fdfc8c32f84e4e0801c2d04b727bbd8 (diff)
downloadgitea-0e183d81fc5283f9d2047472de580e4f04a046c1.tar.gz
gitea-0e183d81fc5283f9d2047472de580e4f04a046c1.zip
Fix missing error check of bufio.Scanner (#29882)
maybe more
Diffstat (limited to 'services')
-rw-r--r--services/asymkey/ssh_key_authorized_principals.go4
-rw-r--r--services/doctor/authorizedkeys.go4
2 files changed, 8 insertions, 0 deletions
diff --git a/services/asymkey/ssh_key_authorized_principals.go b/services/asymkey/ssh_key_authorized_principals.go
index 9154db7dbb..822dd0ffe7 100644
--- a/services/asymkey/ssh_key_authorized_principals.go
+++ b/services/asymkey/ssh_key_authorized_principals.go
@@ -122,6 +122,10 @@ func regeneratePrincipalKeys(ctx context.Context, t io.StringWriter) error {
return err
}
}
+ err = scanner.Err()
+ if err != nil {
+ return fmt.Errorf("scan: %w", err)
+ }
f.Close()
}
return nil
diff --git a/services/doctor/authorizedkeys.go b/services/doctor/authorizedkeys.go
index d5a96605b9..bc0266c4bc 100644
--- a/services/doctor/authorizedkeys.go
+++ b/services/doctor/authorizedkeys.go
@@ -51,6 +51,10 @@ func checkAuthorizedKeys(ctx context.Context, logger log.Logger, autofix bool) e
}
linesInAuthorizedKeys.Add(line)
}
+ err = scanner.Err()
+ if err != nil {
+ return fmt.Errorf("scan: %w", err)
+ }
f.Close()
// now we regenerate and check if there are any lines missing