[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [exonerator/master] Fix NPE caused by invalid parameters.



commit e1e20c06c99f76ae26316410ce5b5f86063b0296
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Oct 16 12:00:34 2017 +0200

    Fix NPE caused by invalid parameters.
    
    Turns out we shouldn't attempt to write a permanent link containing an
    invalid parameter. In this case we wouldn't even write this permanent
    link, because we'd have closed the output stream before. But we still
    ran into the exception while trying.
    
    Reported by ln5, analyzed by iwakeh. Resolves #23488.
---
 .../torproject/exonerator/ExoneraTorServlet.java   | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java b/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java
index cba4420..13d5596 100644
--- a/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java
+++ b/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java
@@ -193,22 +193,22 @@ public class ExoneraTorServlet extends HttpServlet {
       this.writeFooter(out, rb, relayIp, timestampStr);
 
     /* Print out result. */
-    } else if (!statusEntries.isEmpty()) {
-      this.writeSummaryPositive(out, rb, relayIp, timestampStr);
-      this.writeTechnicalDetails(out, rb, relayIp, timestampStr,
-          statusEntries);
-    } else if (addressesInSameNetwork != null
-        && !addressesInSameNetwork.isEmpty()) {
-      this.writeSummaryAddressesInSameNetwork(out, rb, relayIp,
-          timestampStr, langStr, addressesInSameNetwork);
     } else {
-      this.writeSummaryNegative(out, rb, relayIp, timestampStr);
+      if (!statusEntries.isEmpty()) {
+        this.writeSummaryPositive(out, rb, relayIp, timestampStr);
+        this.writeTechnicalDetails(out, rb, relayIp, timestampStr,
+            statusEntries);
+      } else if (addressesInSameNetwork != null
+          && !addressesInSameNetwork.isEmpty()) {
+        this.writeSummaryAddressesInSameNetwork(out, rb, relayIp,
+            timestampStr, langStr, addressesInSameNetwork);
+      } else {
+        this.writeSummaryNegative(out, rb, relayIp, timestampStr);
+      }
+      this.writePermanentLink(out, rb, relayIp, timestampStr, langStr);
+      this.writeFooter(out, rb, relayIp, timestampStr);
     }
 
-    this.writePermanentLink(out, rb, relayIp, timestampStr, langStr);
-
-    this.writeFooter(out, rb, relayIp, timestampStr);
-
     /* Forward to the JSP that adds header and footer. */
     request.setAttribute("lang", langStr);
     request.setAttribute("body", so.toString());



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits