Skip to content

Commit

Permalink
[CRYPTO] scatterwalk: Handle zero nbytes in scatterwalk_map_and_copy
Browse files Browse the repository at this point in the history
It's better to return silently than crash and burn when someone feeds us
a zero length.  In particular the null digest algorithm when used as part
of authenc will do that to us.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jan 10, 2008
1 parent ce5bd4a commit 6e05077
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/scatterwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
struct scatter_walk walk;
unsigned int offset = 0;

if (!nbytes)
return;

for (;;) {
scatterwalk_start(&walk, sg);

Expand Down

0 comments on commit 6e05077

Please sign in to comment.