From 5ff654dab51014a37f7043206ea2fbe685e201f1 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 23 Oct 2012 10:44:31 +0800 Subject: [PATCH] fix NIL case --- src/mod/event_handlers/mod_erlang_event/ei_helpers.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index 0206f37718..9d39b725d7 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -305,6 +305,11 @@ int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst) ei_get_type(buf, index, &type, &size); + if (type == ERL_NIL_EXT || size == 0) { + dst[0] = '\0'; + return 0; + } + if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) { return -1; } else if (size > maxlen) {