• Nicolai Stange's avatar
    lib/mpi: mpi_read_from_buffer(): return -EINVAL upon too short buffer · 7af791e0
    Nicolai Stange authored
    Currently, if the input buffer is shorter than the expected length as
    indicated by its first two bytes, an MPI instance of this expected length
    will be allocated and filled with as much data as is available. The rest
    will remain uninitialized.
    
    Instead of leaving this condition undetected, an error code should be
    reported to the caller.
    
    Since this situation indicates that the input buffer's first two bytes,
    encoding the number of expected bits, are garbled, -EINVAL is appropriate
    here.
    
    If the input buffer is shorter than indicated by its first two bytes,
    make mpi_read_from_buffer() return -EINVAL.
    Get rid of the 'nread' variable: with the new semantics, the total number
    of bytes read from the input buffer is known in advance.
    Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    7af791e0
Name
Last commit
Last update
..
Makefile Loading commit data...
generic_mpih-add1.c Loading commit data...
generic_mpih-lshift.c Loading commit data...
generic_mpih-mul1.c Loading commit data...
generic_mpih-mul2.c Loading commit data...
generic_mpih-mul3.c Loading commit data...
generic_mpih-rshift.c Loading commit data...
generic_mpih-sub1.c Loading commit data...
longlong.h Loading commit data...
mpi-bit.c Loading commit data...
mpi-cmp.c Loading commit data...
mpi-inline.h Loading commit data...
mpi-internal.h Loading commit data...
mpi-pow.c Loading commit data...
mpicoder.c Loading commit data...
mpih-cmp.c Loading commit data...
mpih-div.c Loading commit data...
mpih-mul.c Loading commit data...
mpiutil.c Loading commit data...