diff --git a/proto.c b/proto.c index 353ee6c..f332ee6 100644 --- a/proto.c +++ b/proto.c @@ -383,9 +383,9 @@ decomp(char *src, int len) uLong ucompSize = len + 1; uLong compSize = compressBound(ucompSize); char *dest = malloc(ucompSize); + if (uncompress((Bytef *)dest, &ucompSize, (Bytef *)src, compSize) != Z_OK) { - printf("uncompress failed\n"); free(dest); return NULL; }; @@ -433,19 +433,19 @@ decode_and_inflate(struct blob_attr **encoded_param, struct blob_attr *ret[__JSO char *cp64 = blobmsg_get_string(encoded_param[PARAMS_COMPRESS_64]); char *cp = decode_b64(cp64, compress_sz); if (cp == NULL) { - ULOG_ERR("base64 decode failed for configure message\n"); + ULOG_ERR("base64 decode failed for message\n"); ret = NULL; return; } char *params = decomp(cp, compress_sz); - if (cp == NULL) { - ULOG_ERR("failed to uncompress configure message\n"); + if (params == NULL) { + ULOG_ERR("failed to uncompress message\n"); ret = NULL; return; } + static struct blob_buf pbuf; blob_buf_init(&pbuf, 0); - void *c; c = blobmsg_open_table(&pbuf, "params"); blobmsg_add_json_from_string(&pbuf, params);