commit 087cc2fc09698b114296411034739df31c999471 from: Omar Polo via: Thomas Adam date: Thu Jun 15 11:27:15 2023 UTC gotwebd: make got_get_repo_commits take a size_t and while here make sure 0 is rejected. requested by, improvements and ok stsp@ commit - 1fa505c4ad80469884962571ef13853f1be8dd08 commit + 087cc2fc09698b114296411034739df31c999471 blob - c172d12e5e3176180e7d4fd25b64d9531a5a0ba2 blob + 4b1d31115a72093e73d61604cd06935239a86044 --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -311,7 +311,7 @@ got_get_repo_commit(struct request *c, struct repo_com } const struct got_error * -got_get_repo_commits(struct request *c, int limit) +got_get_repo_commits(struct request *c, size_t limit) { const struct got_error *error = NULL; struct got_object_id *id = NULL; @@ -328,7 +328,10 @@ got_get_repo_commits(struct request *c, int limit) char *in_repo_path = NULL, *repo_path = NULL, *file_path = NULL; int chk_next = 0; - if (limit != 1 || srv->max_commits_display == 1) { + if (limit == 0) + return got_error(GOT_ERR_RANGE); + + if (limit > 1) { /* * Traverse one commit more than requested to provide * the next button. blob - d7d5433a5cc1129adfe0e4b5d94a8b24cc657002 blob + cfcd977e45fabb46eb8dc44a05b3bf82623e74e0 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -511,7 +511,7 @@ const struct got_error *got_gotweb_closefile(FILE *); const struct got_error *got_get_repo_owner(char **, struct request *); const struct got_error *got_get_repo_age(time_t *, struct request *, const char *); -const struct got_error *got_get_repo_commits(struct request *, int); +const struct got_error *got_get_repo_commits(struct request *, size_t); const struct got_error *got_get_repo_tags(struct request *, int); const struct got_error *got_get_repo_heads(struct request *); const struct got_error *got_open_diff_for_output(FILE **, struct request *);