X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;ds=sidebyside;f=cgi%2Fhashquery.c;h=84efe97e514ae7b89d254b46e626fd9a416e8ac4;hb=e83421524e00d9cd636ad697eb3121f504339c9e;hp=5c056a2d3298ab3bb37769cbcd92eb1c0faae7f4;hpb=3877403043acfbfa57497d3ba51a5ec2db1c77dc;p=onak.git diff --git a/cgi/hashquery.c b/cgi/hashquery.c index 5c056a2..84efe97 100644 --- a/cgi/hashquery.c +++ b/cgi/hashquery.c @@ -23,6 +23,7 @@ #include #include +#include "build-config.h" #include "charfuncs.h" #include "cleanup.h" #include "keydb.h" @@ -40,9 +41,9 @@ void doerror(char *error) exit(EXIT_FAILURE); } -int main(int argc, char *argv[]) +int main(__unused int argc, __unused char *argv[]) { - char *request_method; + char *request_method, *env; int count, found, i; uint8_t **hashes; struct buffer_ctx cgipostbuf; @@ -57,7 +58,8 @@ int main(int argc, char *argv[]) doerror("hashquery must be a HTTP POST request.\n"); } - if (!(cgipostbuf.size = atoi(getenv("CONTENT_LENGTH")))) { + env = getenv("CONTENT_LENGTH"); + if ((env == NULL) || !(cgipostbuf.size = atoi(env))) { doerror("Must provide a content length.\n"); }