* Try to get correct buffer size to avoid races fixes #51393 * fix test, mock buffer function since all is mocked