diff options
author | Harlan Stenn <stenn@ntp.org> | 2011-08-27 05:48:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-08-28 13:44:33 -0400 |
commit | 7c11e51e1ab19e1eebc7f03d1a7a51f54acf7c32 (patch) | |
tree | 3803c4587bcdfc165c38e0ce12a09c5c1e4cbf07 /sample/http-server.c | |
parent | 5b18f13048d4d6e65ee93438a052e4d904f3f639 (diff) | |
download | libevent-7c11e51e1ab19e1eebc7f03d1a7a51f54acf7c32.tar.gz |
Clean up some problems identified by Coverity.
Diffstat (limited to 'sample/http-server.c')
-rw-r--r-- | sample/http-server.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sample/http-server.c b/sample/http-server.c index 75caa414..cd6b27af 100644 --- a/sample/http-server.c +++ b/sample/http-server.c @@ -133,7 +133,8 @@ dump_request_cb(struct evhttp_request *req, void *arg) int n; char cbuf[128]; n = evbuffer_remove(buf, cbuf, sizeof(buf)-1); - fwrite(cbuf, 1, n, stdout); + if (n > 0) + fwrite(cbuf, 1, n, stdout); } puts(">>>"); @@ -179,6 +180,8 @@ send_document_cb(struct evhttp_request *req, void *arg) /* We need to decode it, to see what path the user really wanted. */ decoded_path = evhttp_uridecode(path, 0, NULL); + if (decoded_path == NULL) + goto err; /* Don't allow any ".."s in the path, to avoid exposing stuff outside * of the docroot. This test is both overzealous and underzealous: * it forbids aceptable paths like "/this/one..here", but it doesn't |