ZDR_ARRAY: remove the check for element-size * num-objects
In zdr_array we can not use the check that num_elements * element_size will fit inside the remaining bytes in the ZDR buffer. The reason for this is that IF it is an array of unions, then element-size will have the size of the largest arm in that union. If the array consists of union items that are smaller than the largest arm, then it becomes likely that this will pack in less than num_elements * element_size and this it is possible that the array WILL fir in the remaining bytes. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>libnfs-4.0.0-vitalif
parent
a2b37349fa
commit
468424c475
|
@ -312,10 +312,6 @@ bool_t libnfs_zdr_array(ZDR *zdrs, char **arrp, uint32_t *size, uint32_t maxsize
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (zdrs->pos + (int)(*size * elsize) > zdrs->size) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (zdrs->x_op == ZDR_DECODE) {
|
||||
*arrp = zdr_malloc(zdrs, *size * elsize);
|
||||
if (*arrp == NULL) {
|
||||
|
|
Loading…
Reference in New Issue