Fix incorrect length cast

Change-Id: I68d716bd152f0dd1a0a6fbdbb9cd0889cae12e9d
Reviewed-on: http://review.couchbase.org/24056
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>