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.
Merge pull request #343 from neithernut/fix-union_int-assignment

Fix type of buffer var