소스 검색

Avoid a possible crash in tls_log_errors.

We were checking for msg==NULL, but not lib or proc.  This case can
only occur if we have an error whose string we somehow haven't loaded,
but it's worth coding defensively here.

Spotted by rieo on IRC.
Nick Mathewson 14 년 전
부모
커밋
4ad5094c90
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      src/common/tortls.c

+ 2 - 0
src/common/tortls.c

@@ -180,6 +180,8 @@ tls_log_errors(tor_tls_t *tls, int severity, const char *doing)
     lib = (const char*)ERR_lib_error_string(err);
     func = (const char*)ERR_func_error_string(err);
     if (!msg) msg = "(null)";
+    if (!lib) lib = "(null)";
+    if (!func) func = "(null)";
     if (doing) {
       log(severity, LD_NET, "TLS error while %s%s%s: %s (in %s:%s)",
           doing, addr?" with ":"", addr?addr:"",