Use length parameter instead of the buffer array length Reviewed-by: rriggs, alanb
Reviewed-by: darcy, ihse