mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-09 15:22:11 -04:00
Skip call to memcpy if buffer length is zero
This allows the copy functions to work when passed a (NULL, 0) buffer. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
df49355faa
commit
660027f310
@ -5543,7 +5543,9 @@ psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
|
||||
return PSA_ERROR_CORRUPTION_DETECTED;
|
||||
}
|
||||
|
||||
if (input_len > 0) {
|
||||
memcpy(input_copy, input, input_len);
|
||||
}
|
||||
|
||||
return PSA_SUCCESS;
|
||||
}
|
||||
@ -5567,7 +5569,11 @@ psa_status_t psa_crypto_copy_output(const uint8_t *output_copy, size_t output_co
|
||||
if (output_len < output_copy_len) {
|
||||
return PSA_ERROR_CORRUPTION_DETECTED;
|
||||
}
|
||||
|
||||
if (output_copy_len > 0) {
|
||||
memcpy(output, output_copy, output_copy_len);
|
||||
}
|
||||
|
||||
return PSA_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user