diff options
author | tpashkin <tpashkin@yandex-team.ru> | 2022-02-10 16:46:42 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:42 +0300 |
commit | 656921707c02b816d730f31c1fdc1d615adbfe00 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/openssl/crypto/asn1/asn1_lib.c | |
parent | 5475379a04e37df30085bd1724f1c57e3f40996f (diff) | |
download | ydb-656921707c02b816d730f31c1fdc1d615adbfe00.tar.gz |
Restoring authorship annotation for <tpashkin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/openssl/crypto/asn1/asn1_lib.c')
-rw-r--r-- | contrib/libs/openssl/crypto/asn1/asn1_lib.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/contrib/libs/openssl/crypto/asn1/asn1_lib.c b/contrib/libs/openssl/crypto/asn1/asn1_lib.c index c1aa40ca06..3d99d1383d 100644 --- a/contrib/libs/openssl/crypto/asn1/asn1_lib.c +++ b/contrib/libs/openssl/crypto/asn1/asn1_lib.c @@ -11,7 +11,7 @@ #include <limits.h> #include "internal/cryptlib.h" #include <openssl/asn1.h> -#include "asn1_local.h" +#include "asn1_local.h" static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max); @@ -268,29 +268,29 @@ ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) return ret; } -int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len_in) +int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len_in) { unsigned char *c; const char *data = _data; - size_t len; + size_t len; - if (len_in < 0) { + if (len_in < 0) { if (data == NULL) return 0; - len = strlen(data); - } else { - len = (size_t)len_in; + len = strlen(data); + } else { + len = (size_t)len_in; + } + /* + * Verify that the length fits within an integer for assignment to + * str->length below. The additional 1 is subtracted to allow for the + * '\0' terminator even though this isn't strictly necessary. + */ + if (len > INT_MAX - 1) { + ASN1err(0, ASN1_R_TOO_LARGE); + return 0; } - /* - * Verify that the length fits within an integer for assignment to - * str->length below. The additional 1 is subtracted to allow for the - * '\0' terminator even though this isn't strictly necessary. - */ - if (len > INT_MAX - 1) { - ASN1err(0, ASN1_R_TOO_LARGE); - return 0; - } - if ((size_t)str->length <= len || str->data == NULL) { + if ((size_t)str->length <= len || str->data == NULL) { c = str->data; #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION /* No NUL terminator in fuzzing builds */ |