diff --git a/src/ext/readerResp.c b/src/ext/readerResp.c index 98f20b5..d9beeb2 100644 --- a/src/ext/readerResp.c +++ b/src/ext/readerResp.c @@ -299,9 +299,10 @@ static RespRes readRespReplyBulkArray(RespReaderCtx *ctx, RespReplyBuff *buffInf return RESP_REPLY_ERR; } + /* if empty array then jump to READ_END of array */ if (ctx->numBulksArray == 0) { - snprintf(ctx->errorMsg, sizeof(ctx->errorMsg), "Bulk Array must be bigger than zero"); - return RESP_REPLY_ERR; + ctx->typeArrayState = READ_END; + break; } ctx->typeArrayState = READ_NEXT_BULK_HDR; diff --git a/test/test_resp_reader.c b/test/test_resp_reader.c index 44da150..70af31e 100644 --- a/test/test_resp_reader.c +++ b/test/test_resp_reader.c @@ -118,8 +118,8 @@ static void test_reply_long_err_trimmed_by_report(void **state) { static void test_mixture_and_fragmented(void **state) { UNUSED(state); RespRes res; - int expReplies = 5; - char bulk[] = "*3\r\n$2\r\n12\r\n$1\r\nA\r\n$3\r\nABC\r\n" + int expReplies = 6; + char bulk[] = "*0\r\n*3\r\n$2\r\n12\r\n$1\r\nA\r\n$3\r\nABC\r\n" "+OK\r\n$5\r\nmylib\r\n+OK\r\n+OK\r\n"; RespReaderCtx ctx;