X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=crypto%2Fasn1%2Fx_int64.c;h=33e406169945f75b2178c7f216902d663a968ed9;hb=0856e3f167964f58c26796331eab9d8b0a883921;hp=d180a3bb3ac08490cbbebaed3df96e81183b3a38;hpb=93f7d6fc10b75814d90d804edb56947cacf8964e;p=openssl.git diff --git a/crypto/asn1/x_int64.c b/crypto/asn1/x_int64.c index d180a3bb3a..33e4061699 100644 --- a/crypto/asn1/x_int64.c +++ b/crypto/asn1/x_int64.c @@ -9,8 +9,8 @@ #include #include "internal/cryptlib.h" -#include "internal/asn1t.h" #include "internal/numbers.h" +#include #include #include "asn1_locl.h" @@ -71,6 +71,11 @@ static int uint64_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, ASN1err(ASN1_F_UINT64_C2I, ASN1_R_ILLEGAL_NEGATIVE_VALUE); return 0; } + if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED + && !neg && utmp > INT64_MAX) { + ASN1err(ASN1_F_UINT64_C2I, ASN1_R_TOO_LARGE); + return 0; + } memcpy(cp, &utmp, sizeof(utmp)); return 1; }