aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/decode/decode_ref.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-01-30 19:15:30 +0100
committerSverker Eriksson <[email protected]>2013-01-30 19:15:30 +0100
commitf822540687d16eecfcd2d74b55091593c674d478 (patch)
tree5ee5285e3b367dcd398468295044933d31dbd261 /lib/erl_interface/src/decode/decode_ref.c
parent68b804f34d4ec420d86953e3f519179a40fbee8f (diff)
downloadotp-f822540687d16eecfcd2d74b55091593c674d478.tar.gz
otp-f822540687d16eecfcd2d74b55091593c674d478.tar.bz2
otp-f822540687d16eecfcd2d74b55091593c674d478.zip
erl_interface: Fix ei_skip_term
Diffstat (limited to 'lib/erl_interface/src/decode/decode_ref.c')
-rw-r--r--lib/erl_interface/src/decode/decode_ref.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/erl_interface/src/decode/decode_ref.c b/lib/erl_interface/src/decode/decode_ref.c
index 579371ed7d..01e3061cb4 100644
--- a/lib/erl_interface/src/decode/decode_ref.c
+++ b/lib/erl_interface/src/decode/decode_ref.c
@@ -30,17 +30,16 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p)
switch (get8(s)) {
case ERL_REFERENCE_EXT:
-
- /* nodename */
- if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1;
-
- /* now the numbers: num (4), creation (1) */
if (p) {
+ if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1;
p->n[0] = get32be(s);
p->len = 1;
p->creation = get8(s) & 0x03;
}
- else s += 5;
+ else {
+ if (get_atom(&s, NULL, NULL) < 0) return -1;
+ s += 5;
+ }
*index += s-s0;
@@ -50,16 +49,16 @@ int ei_decode_ref(const char *buf, int *index, erlang_ref *p)
case ERL_NEW_REFERENCE_EXT:
/* first the integer count */
count = get16be(s);
- if (p) p->len = count;
- /* then the nodename */
- if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1;
-
- /* creation */
if (p) {
+ p->len = count;
+ if (get_atom(&s, p->node, &p->node_org_enc) < 0) return -1;
p->creation = get8(s) & 0x03;
}
- else s += 1;
+ else {
+ if (get_atom(&s, NULL, NULL) < 0) return -1;
+ s += 1;
+ }
/* finally the id integers */
if (p) {