c
size_t total_size = ...; // Total allocated size of *pData
if (wpos + bplen > total_size) {
    goto fail;
}
memcpy(&(*pData)[wpos], bptr, bplen);
