check required querystring commit exists for gw_tags
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index d2f3218..ca4789a 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -1440,7 +1440,12 @@ gw_tag(struct gw_trans *gw_trans)
if (error)
goto done;
- khttp_puts(gw_trans->gw_req, header->commit_id);
+ if (gw_trans->commit_id == NULL) {
+ error = got_error_msg(GOT_ERR_QUERYSTRING,
+ "commit required in querystring");
+ goto done;
+ }
+
error = gw_get_header(gw_trans, header, 1);
if (error)
goto done;
diff --git a/include/got_error.h b/include/got_error.h
index 888f9dd..ae6efb2 100644
--- a/include/got_error.h
+++ b/include/got_error.h
@@ -130,6 +130,7 @@
#define GOT_ERR_GITCONFIG_SYNTAX 114
#define GOT_ERR_REBASE_OUT_OF_DATE 115
#define GOT_ERR_CACHE_DUP_ENTRY 116
+#define GOT_ERR_QUERYSTRING 117
static const struct got_error {
int code;
@@ -267,6 +268,7 @@ static const struct got_error {
{ GOT_ERR_REBASE_OUT_OF_DATE, "work tree must be updated before it "
"can be used to rebase a branch" },
{ GOT_ERR_CACHE_DUP_ENTRY, "duplicate cache entry" },
+ { GOT_ERR_QUERYSTRING, "bad querystring" },
};
/*