Fixed invalid cast caught by clang ubsan

'large' values, like 255, were being cast to 'char' which, on many
platforms, can hold max 127, invoking undefined behaviour.  The buffer
was already typed 'unsigned char', so I just changed the cast.

Change-Id: I16b6f135f29f1e8adf61bd71b44067bc75cc8ede
Merge topic 'vtk-hackathon-misc-fixes' into master

d15a1de3 Fixed invalid cast caught by clang ubsan