Simplify another CBS_write_bytes() call in d2i_SSL_SESSION()
authortb <tb@openbsd.org>
Tue, 7 Jun 2022 17:53:42 +0000 (17:53 +0000)
committertb <tb@openbsd.org>
Tue, 7 Jun 2022 17:53:42 +0000 (17:53 +0000)
ok jsing

lib/libssl/ssl_asn1.c

index d513811..6095a73 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_asn1.c,v 1.64 2022/06/07 17:45:13 tb Exp $ */
+/* $OpenBSD: ssl_asn1.c,v 1.65 2022/06/07 17:53:42 tb Exp $ */
 /*
  * Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
  *
@@ -348,11 +348,8 @@ d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length)
                goto err;
        if (present) {
                if (!CBS_write_bytes(&session_id, (uint8_t *)&s->sid_ctx,
-                   sizeof(s->sid_ctx), &data_len))
+                   sizeof(s->sid_ctx), &s->sid_ctx_length))
                        goto err;
-               if (data_len > UINT_MAX)
-                       goto err;
-               s->sid_ctx_length = (unsigned int)data_len;
        }
 
        /* Verify result [5]. */