mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
lejp: dont underflow with anonymous braces
This commit is contained in:
parent
a76e9aad11
commit
2b30c82b9e
1 changed files with 8 additions and 5 deletions
|
@ -199,7 +199,6 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
|
|||
|
||||
while (len--) {
|
||||
c = *json++;
|
||||
|
||||
s = ctx->st[ctx->sp].s;
|
||||
|
||||
/* skip whitespace unless we should care */
|
||||
|
@ -615,8 +614,10 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
|
|||
goto reject;
|
||||
}
|
||||
/* drop the path [n] bit */
|
||||
ctx->ppos = ctx->st[ctx->sp - 1].p;
|
||||
ctx->ipos = ctx->st[ctx->sp - 1].i;
|
||||
if (ctx->sp) {
|
||||
ctx->ppos = ctx->st[ctx->sp - 1].p;
|
||||
ctx->ipos = ctx->st[ctx->sp - 1].i;
|
||||
}
|
||||
ctx->path[ctx->ppos] = '\0';
|
||||
if (ctx->path_match &&
|
||||
ctx->ppos <= ctx->path_match_len)
|
||||
|
@ -642,8 +643,10 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
|
|||
}
|
||||
/* pop */
|
||||
ctx->sp--;
|
||||
ctx->ppos = ctx->st[ctx->sp - 1].p;
|
||||
ctx->ipos = ctx->st[ctx->sp - 1].i;
|
||||
if (ctx->sp) {
|
||||
ctx->ppos = ctx->st[ctx->sp - 1].p;
|
||||
ctx->ipos = ctx->st[ctx->sp - 1].i;
|
||||
}
|
||||
ctx->path[ctx->ppos] = '\0';
|
||||
if (ctx->path_match &&
|
||||
ctx->ppos <= ctx->path_match_len)
|
||||
|
|
Loading…
Add table
Reference in a new issue