]> source.dussan.org Git - gitea.git/commitdiff
Avoid arbitrary format strings upon calling fail() function (#7112)
authorSandro Santilli <strk@kbt.io>
Mon, 3 Jun 2019 08:07:03 +0000 (10:07 +0200)
committerzeripath <art27@cantab.net>
Mon, 3 Jun 2019 08:07:03 +0000 (09:07 +0100)
cmd/serv.go

index aa068d4cf693fb3106aa9cecf17742aefbd09a59..0b0a4e8efba78ce03b0b661fdfad01f45eae647a 100644 (file)
@@ -53,7 +53,7 @@ func checkLFSVersion() {
                //Needs at least git v2.1.2
                binVersion, err := git.BinVersion()
                if err != nil {
-                       fail(fmt.Sprintf("Error retrieving git version: %v", err), fmt.Sprintf("Error retrieving git version: %v", err))
+                       fail("LFS server error", "Error retrieving git version: %v", err)
                }
 
                if !version.Compare(binVersion, "2.1.2", ">=") {
@@ -199,12 +199,12 @@ func runServ(c *cli.Context) error {
                if private.IsErrServCommand(err) {
                        errServCommand := err.(private.ErrServCommand)
                        if errServCommand.StatusCode != http.StatusInternalServerError {
-                               fail("Unauthorized", errServCommand.Error())
+                               fail("Unauthorized", "%s", errServCommand.Error())
                        } else {
-                               fail("Internal Server Error", errServCommand.Error())
+                               fail("Internal Server Error", "%s", errServCommand.Error())
                        }
                }
-               fail("Internal Server Error", err.Error())
+               fail("Internal Server Error", "%s", err.Error())
        }
        os.Setenv(models.EnvRepoIsWiki, strconv.FormatBool(results.IsWiki))
        os.Setenv(models.EnvRepoName, results.RepoName)