mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Merge pull request #1347 from mpg/fix-asn1-store-named-data-null-deref-3.6
Backport 3.6: Fix asn1 store named data null deref
This commit is contained in:
@ -90,7 +90,9 @@ int mbedtls_asn1_write_raw_buffer(unsigned char **p, const unsigned char *start,
|
||||
|
||||
len = size;
|
||||
(*p) -= len;
|
||||
memcpy(*p, buf, len);
|
||||
if (len != 0) {
|
||||
memcpy(*p, buf, len);
|
||||
}
|
||||
|
||||
return (int) len;
|
||||
}
|
||||
@ -412,6 +414,7 @@ mbedtls_asn1_named_data *mbedtls_asn1_store_named_data(
|
||||
} else if (val_len == 0) {
|
||||
mbedtls_free(cur->val.p);
|
||||
cur->val.p = NULL;
|
||||
cur->val.len = 0;
|
||||
} else if (cur->val.len != val_len) {
|
||||
/*
|
||||
* Enlarge existing value buffer if needed
|
||||
|
Reference in New Issue
Block a user