소스 검색

Merge branch 'maint-0.2.7'

Nick Mathewson 9 년 전
부모
커밋
ee5337e904
2개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 0
      changes/bug17722
  2. 5 1
      src/or/torcert.c

+ 3 - 0
changes/bug17722

@@ -0,0 +1,3 @@
+  o Minor bugfixes (code correctness)
+    - Fix undefined behavior in the tor_cert_checksig function. Fixes bug
+      17722; bugfix on tor-0.2.7.2-alpha.

+ 5 - 1
src/or/torcert.c

@@ -206,7 +206,11 @@ tor_cert_checksig(tor_cert_t *cert,
     return -1;
   } else {
     cert->sig_ok = 1;
-    memcpy(cert->signing_key.pubkey, checkable.pubkey->pubkey, 32);
+    /* Only copy the checkable public key when it is different from the signing
+     * key of the certificate to avoid undefined behavior. */
+    if (cert->signing_key.pubkey != checkable.pubkey->pubkey) {
+      memcpy(cert->signing_key.pubkey, checkable.pubkey->pubkey, 32);
+    }
     cert->cert_valid = 1;
     return 0;
   }