]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
scan-build: bulletproof last-chance errormsg generation in rendservice.c
authorNick Mathewson <nickm@torproject.org>
Sat, 19 Apr 2014 01:24:16 +0000 (21:24 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 19 Apr 2014 01:24:16 +0000 (21:24 -0400)
If 'intro' is NULL in these functions, I'm pretty sure that the
error message must be set before we hit the end.  But scan-build
doesn't notice that, and is worried that we'll do a null-pointer
dereference in the last-chance errormsg generation.

src/or/rendservice.c

index abd78da73a3195e3bed11a7cea2fed1bb5418511..5a81d078565589f0d3d5538c5c1c5fbe123d555b 100644 (file)
@@ -2041,7 +2041,7 @@ rend_service_decrypt_intro(
   if (err_msg_out && !err_msg) {
     tor_asprintf(&err_msg,
                  "unknown INTRODUCE%d error decrypting encrypted part",
-                 (int)(intro->type));
+                 intro ? (int)(intro->type) : -1);
   }
   if (status >= 0) status = -1;
 
@@ -2147,7 +2147,7 @@ rend_service_parse_intro_plaintext(
   if (err_msg_out && !err_msg) {
     tor_asprintf(&err_msg,
                  "unknown INTRODUCE%d error parsing encrypted part",
-                 (int)(intro->type));
+                 intro ? (int)(intro->type) : -1);
   }
   if (status >= 0) status = -1;