[or-cvs] r13599: start checking the return value of crypto_pk_asn1_encode() w (tor/trunk/src/or)

arma at seul.org arma at seul.org
Tue Feb 19 23:33:02 UTC 2008


Author: arma
Date: 2008-02-19 18:33:02 -0500 (Tue, 19 Feb 2008)
New Revision: 13599

Modified:
   tor/trunk/src/or/rendservice.c
Log:
start checking the return value of crypto_pk_asn1_encode() while
we're trying to establish an introduction point. bug reported
by veracode.


Modified: tor/trunk/src/or/rendservice.c
===================================================================
--- tor/trunk/src/or/rendservice.c	2008-02-19 23:29:45 UTC (rev 13598)
+++ tor/trunk/src/or/rendservice.c	2008-02-19 23:33:02 UTC (rev 13599)
@@ -850,8 +850,14 @@
   else
     intro_key = circuit->intro_key;
   /* Build the payload for a RELAY_ESTABLISH_INTRO cell. */
-  len = crypto_pk_asn1_encode(intro_key, buf+2,
-                              RELAY_PAYLOAD_SIZE-2);
+  r = crypto_pk_asn1_encode(intro_key, buf+2,
+                            RELAY_PAYLOAD_SIZE-2);
+  if (r < 0) {
+    log_warn(LD_BUG, "Internal error; failed to establish intro point.");
+    reason = END_CIRC_REASON_INTERNAL;
+    goto err;
+  }
+  len = r;
   set_uint16(buf, htons((uint16_t)len));
   len += 2;
   memcpy(auth, circuit->cpath->prev->handshake_digest, DIGEST_LEN);



More information about the tor-commits mailing list