Skip to content

Commit b118514

Browse files
committed
This behavior fixed: if user pass empty input string as value, then nginx return error
1 parent 4877a2c commit b118514

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tp_transcode.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#include <stdint.h>
5252
#include <inttypes.h>
5353

54-
#if 0
54+
#if 1
5555
#define dd(...) fprintf(stderr, __VA_ARGS__)
5656
#else
5757
#define dd(...)
@@ -316,10 +316,14 @@ yajl_string(void *ctx, const unsigned char * str, size_t len)
316316

317317
dd("string: %.*s\n", (int)len, str);
318318

319+
stack_grow_array(s_ctx);
320+
319321
if (len > 0) {
320-
stack_grow_array(s_ctx);
321322
if (unlikely(!tp_encode_str(&s_ctx->tp, (const char *)str, len)))
322323
say_overflow_r_2(s_ctx);
324+
} else {
325+
if (unlikely(!tp_encode_str(&s_ctx->tp, "", 0)))
326+
say_overflow_r_2(s_ctx);
323327
}
324328

325329
} else if (s_ctx->read_method && s_ctx->stage == METHOD) {

0 commit comments

Comments
 (0)