From 077c4e7bb226de0f6414674e01a838498a49867b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 11 Mar 2015 13:26:18 +0100 Subject: [PATCH] Fix SEGV yaz-client with SRU target www.bergen.folkebibl.no/cgi-bin/sru YAZ-829 This does not fix the decoding probelm with excessive bytes persists YAZ-830 --- src/http.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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, '#'); -- 1.7.10.4