[#2212] CID54898:

Check bounds of size before allocating buffer of that size