From f69dbeee28ec0cacf4ed1ffc4601b59a9178c794 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 20 Jan 2020 10:52:32 +0100 Subject: fix error handling --- src/json/json_mhd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/json/json_mhd.c') diff --git a/src/json/json_mhd.c b/src/json/json_mhd.c index 3d3f003be..0cc2e92dc 100644 --- a/src/json/json_mhd.c +++ b/src/json/json_mhd.c @@ -186,24 +186,26 @@ inflate_data (struct Buffer *buf) ret = inflate (&z, 0); switch (ret) { + case Z_BUF_ERROR: + GNUNET_break_op (0); + GNUNET_break (Z_OK == inflateEnd (&z)); + GNUNET_free (tmp); + return GNUNET_JSON_PR_JSON_INVALID; case Z_MEM_ERROR: GNUNET_break (0); GNUNET_break (Z_OK == inflateEnd (&z)); GNUNET_free (tmp); return GNUNET_JSON_PR_OUT_OF_MEMORY; - case Z_DATA_ERROR: GNUNET_break_op (0); GNUNET_break (Z_OK == inflateEnd (&z)); GNUNET_free (tmp); return GNUNET_JSON_PR_JSON_INVALID; - case Z_NEED_DICT: GNUNET_break_op (0); GNUNET_break (Z_OK == inflateEnd (&z)); GNUNET_free (tmp); return GNUNET_JSON_PR_JSON_INVALID; - case Z_OK: if ((0 < z.avail_out) && (0 == z.avail_in)) { @@ -231,7 +233,6 @@ inflate_data (struct Buffer *buf) tmp = GNUNET_realloc (tmp, tmp_size); z.next_out = (Bytef *) &tmp[z.total_out]; continue; - case Z_STREAM_END: /* decompression successful, make 'tmp' the new 'data' */ GNUNET_free (buf->data); -- cgit v1.2.3