diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-08-06 01:25:17 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-08-24 20:58:31 +0200 |
commit | 750e7a6282a4eaf58b5309ece1caedb238d44853 (patch) | |
tree | 11d3438634c3374cc2f211a019c81162d0837484 /userspace/ncrypto_key.c | |
parent | 086611087534593e8543c193ac12a6b07865be26 (diff) | |
download | cryptodev-linux-750e7a6282a4eaf58b5309ece1caedb238d44853.tar.gz cryptodev-linux-750e7a6282a4eaf58b5309ece1caedb238d44853.tar.xz cryptodev-linux-750e7a6282a4eaf58b5309ece1caedb238d44853.zip |
Use EOVERFLOW if input data is too large
Diffstat (limited to 'userspace/ncrypto_key.c')
-rw-r--r-- | userspace/ncrypto_key.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/userspace/ncrypto_key.c b/userspace/ncrypto_key.c index 47d4c94..758ff6f 100644 --- a/userspace/ncrypto_key.c +++ b/userspace/ncrypto_key.c @@ -218,8 +218,10 @@ ncr_key_import(ncr_key_t key, void *idata, size_t idata_size, void *id, size_t i io.key = key; io.idata = idata; io.idata_size = idata_size; - if (id_size > MAX_KEY_ID_SIZE) - id_size = MAX_KEY_ID_SIZE; + if (id_size > MAX_KEY_ID_SIZE) { + errno = EOVERFLOW; + return -1; + } memmove(&io.key_id, id, id_size); io.key_id_size = id_size; io.algorithm = algorithm; |