From: Adam Dickmeiss Date: Wed, 11 Mar 2015 12:26:18 +0000 (+0100) Subject: Fix SEGV yaz-client with SRU target www.bergen.folkebibl.no/cgi-bin/sru YAZ-829 X-Git-Tag: v5.10.2~5 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=077c4e7bb226de0f6414674e01a838498a49867b;p=yaz-moved-to-github.git Fix SEGV yaz-client with SRU target bergen.folkebibl.no/cgi-bin/sru YAZ-829 This does not fix the decoding probelm with excessive bytes persists YAZ-830 --- diff --git a/src/http.c b/src/http.c index 54521b1..0fdd465 100644 --- a/src/http.c +++ b/src/http.c @@ -511,6 +511,12 @@ int yaz_decode_http_request(ODR o, Z_HTTP_Request **hr_p) int lspace = 0; *hr_p = hr; + hr->method = 0; + hr->version = 0; + hr->path = 0; + hr->headers = 0; + hr->content_buf = 0; + hr->content_len = 0; /* method .. */ for (i = 0; buf[i] != ' '; i++) if (i >= size-5 || i > 30) @@ -613,6 +619,8 @@ int yaz_encode_http_request(ODR o, Z_HTTP_Request *hr) char *cp; int top0 = o->op->top; + if (!hr->method || !hr->path) + return 0; odr_write(o, hr->method, strlen(hr->method)); odr_write(o, " ", 1); cp = strchr(hr->path, '#');