Fix type of buffer var

If we internally use intmax_t, but the buffer used for transmission is
an uin32_t, we end up with completely different values for negative
and/or big numbers.