Explorar o código

[CRYPTO] scatterwalk: Handle zero nbytes in scatterwalk_map_and_copy

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 <herbert@gondor.apana.org.au>
Herbert Xu %!s(int64=17) %!d(string=hai) anos
pai
achega
6e050778c5
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      crypto/scatterwalk.c

+ 3 - 0
crypto/scatterwalk.c

@@ -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);