MVA in UDF - how to return \0s?

Trying to compile a UDF for MVA field that is supposed to return a raw data stream in uint32 format (4-byte). The idea is to directly feed the output to javascript’s ArrayBuffer().
Since any output of UDF seems to be truncated on ‘null’ bytes, how can i achieve that?

So far i have:

#include <sphinxudf.h>
#include <string.h>
#include <stdio.h>
int mvabit_ver()
{
    return SPH_UDF_VERSION;
}

int mvabit_init ( SPH_UDF_INIT * init, SPH_UDF_ARGS * args, char * error_message )
{
        int i;
        for (i=0;i<args->arg_count;i++)
        {
                if (args->arg_types[i]!=SPH_UDF_TYPE_UINT32SET)
                {
                        snprintf ( error_message, SPH_UDF_ERROR_LEN, "mvabit() requires MVA field arguments" );
                        return 1;
                }
        }
        return 0;
}


char * mvabit ( SPH_UDF_INIT * init, SPH_UDF_ARGS * args, char * error_flag )
{
    const int * mva = (unsigned *) args->arg_values[0];

    int i, mva_len;
    char * res;

    mva_len = *args->str_lengths;

    res = (char*) args->fn_malloc( mva_len*4 );

    for ( i=0; i < mva_len; i+=4 ) {
      mva++;
      memcpy( &res[i], mva, 4);
    }
    return res;
}

Is there a way to let manticore know the length of char string i am returning, so no truncation on ‘null’ is being made?

for now there is no way of return MVA buffer from UDF call, the only supported types are int, float, string.

You might create ticket at Github with feature request to get such functionality.

The related issue is https://github.com/manticoresoftware/manticoresearch/issues/531