X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=cgi%2Fhashquery.c;h=a8ca3d06109d0b909a80c6aaa7ef4c84f6db65e9;hb=c0fee41b459cc3822d890bac98882a6c9696c033;hp=5c056a2d3298ab3bb37769cbcd92eb1c0faae7f4;hpb=e82fd57b92d94287f728e37a3e17aaab11b722b8;p=onak.git diff --git a/cgi/hashquery.c b/cgi/hashquery.c index 5c056a2..a8ca3d0 100644 --- a/cgi/hashquery.c +++ b/cgi/hashquery.c @@ -42,7 +42,7 @@ void doerror(char *error) int main(int argc, char *argv[]) { - char *request_method; + char *request_method, *env; int count, found, i; uint8_t **hashes; struct buffer_ctx cgipostbuf; @@ -57,7 +57,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"); }