The key point (which I believe static analysers these days can easily check for) is to check the sizes of the source and destination.