]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid a possible crash in tls_log_errors.
authorNick Mathewson <nickm@torproject.org>
Fri, 22 Jan 2010 21:32:15 +0000 (16:32 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 22 Jan 2010 21:32:15 +0000 (16:32 -0500)
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.

src/common/tortls.c

index 5b323267c18419aae2fdd2d2bc61adcc757b5885..beab5356c50cb0ed981779c53a200159d92a53ae 100644 (file)
@@ -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:"",