diff options
author | Olivier Deprez <olivier.deprez@arm.com> | 2021-07-27 16:06:30 +0200 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2021-07-27 16:06:30 +0200 |
commit | 048fe1916cdd139e8fa9bc22a8d0f88cc3f8e148 (patch) | |
tree | f72d29436532e27187b8efc500bf122a9e652b2b | |
parent | d31f319492fb328b170cb89316f5f0cfab490cae (diff) | |
parent | d0d642450f1f3a0f43e0e156ef57a0c460dd48cf (diff) | |
download | trusted-firmware-a-048fe1916cdd139e8fa9bc22a8d0f88cc3f8e148.tar.gz |
Merge "fix(fdt): fix OOB write in uuid parsing function" into integration
-rw-r--r-- | common/uuid.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/uuid.c b/common/uuid.c index dd3c7b02f5..ac6db50a08 100644 --- a/common/uuid.c +++ b/common/uuid.c @@ -73,6 +73,7 @@ static int read_hex(uint8_t *dest, char *hex_src, unsigned int hex_src_len) int read_uuid(uint8_t *dest, char *uuid) { int err; + uint8_t *dest_start = dest; /* Check that we have enough characters */ if (strnlen(uuid, UUID_STRING_LENGTH) != UUID_STRING_LENGTH) { @@ -124,7 +125,7 @@ int read_uuid(uint8_t *dest, char *uuid) if (err < 0) { WARN("Error parsing UUID\n"); /* Clear the buffer on error */ - memset((void *)dest, '\0', UUID_BYTES_LENGTH * sizeof(uint8_t)); + memset((void *)dest_start, '\0', UUID_BYTES_LENGTH * sizeof(uint8_t)); return -EINVAL; } |