Skip to content

Commit

Permalink
erlang: fix restore index of parsed tuple
Browse files Browse the repository at this point in the history
Avoid to change origin index while parsing tuple.

(cherry picked from commit 74778f3)
  • Loading branch information
seudin committed Jan 4, 2018
1 parent 8f2d55e commit c973e3e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/modules/erlang/handle_rpc.c
Expand Up @@ -486,10 +486,10 @@ int erl_rpc_struct_scan(erl_rpc_ctx_t* ctx, char* fmt, ...)

va_list ap;

/* save index */
/* preserve index */
index = ctx->request_index;

if(ei_decode_tuple_header(ctx->request->buff,&ctx->request_index, &arity))
if(ei_decode_tuple_header(ctx->request->buff,&index, &arity))
{
erl_rpc_fault(ctx,400,"Bad tuple");
return -1;
Expand Down Expand Up @@ -561,9 +561,6 @@ int erl_rpc_struct_scan(erl_rpc_ctx_t* ctx, char* fmt, ...)
fmt++;
}

/* restore index */
ctx->request_index = index;

va_end(ap);
return reads-modifiers;

Expand Down

0 comments on commit c973e3e

Please sign in to comment.