diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-22 20:45:23 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-22 20:45:23 +0200 |
commit | 38ea6e62d3e59f7e03c6c96301d1cedaab15ce3f (patch) | |
tree | 86bec12c7bb0d6bed4827988eca39e796bb2eae3 /drivers | |
parent | Merge branch 'x86/auditsyscall' of git://git.kernel.org/pub/scm/linux/kernel/... (diff) | |
parent | crypto: talitos - fix bug in sg_copy_end_to_buffer (diff) | |
download | linux-38ea6e62d3e59f7e03c6c96301d1cedaab15ce3f.tar.xz linux-38ea6e62d3e59f7e03c6c96301d1cedaab15ce3f.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: talitos - fix bug in sg_copy_end_to_buffer
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/talitos.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 637c105f53d2..bd78acf3c365 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1183,10 +1183,14 @@ static size_t sg_copy_end_to_buffer(struct scatterlist *sgl, unsigned int nents, /* Copy part of this segment */ ignore = skip - offset; len = miter.length - ignore; + if (boffset + len > buflen) + len = buflen - boffset; memcpy(buf + boffset, miter.addr + ignore, len); } else { - /* Copy all of this segment */ + /* Copy all of this segment (up to buflen) */ len = miter.length; + if (boffset + len > buflen) + len = buflen - boffset; memcpy(buf + boffset, miter.addr, len); } boffset += len; |