buffer: use size_t instead of uint32_t to avoid segmentation fault
Fixes: https://github.com/nodejs/node/issues/46836
If tests are needed for this, I'll need some guidance about how to do it as I don't know how to test if something produce a segfault or not.