]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix NIL case
authorSeven Du <dujinfang@gmail.com>
Tue, 23 Oct 2012 02:44:31 +0000 (10:44 +0800)
committerSeven Du <dujinfang@gmail.com>
Tue, 23 Oct 2012 02:44:51 +0000 (10:44 +0800)
src/mod/event_handlers/mod_erlang_event/ei_helpers.c

index 0206f37718e107d7360cdefbff68fedaf2982c52..9d39b725d7a86d46bf5c85a23dfc7e8f2e42cbf4 100644 (file)
@@ -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) {