]> jxnshi.xyz Git - jxnshi.xyz.git/commitdiff
Fix name too long crash
authorjxnshi <jxnshi@proton.me>
Sun, 26 Jan 2025 11:21:43 +0000 (12:21 +0100)
committerjxnshi <jxnshi@proton.me>
Sun, 26 Jan 2025 11:21:43 +0000 (12:21 +0100)
public/index.html
src/main.zig

index ade3787ff6307635475824122ec405614d4f6e0a..4ab171d561c7abb2f2bc07cb5f0bcd9d8725d946 100644 (file)
@@ -9,7 +9,7 @@
     <h2>Cool sites</h2>
     <ul id="cool-sites">
         <li><a href="https://kyun.host">kyun.host</a></li>
-        <li><a href="https://randall0755.neocities.org">randall0755</a></li>
+        <li><a href="https://randall0755.neocities.org"><img alt="centralia" src="https://randall0755.neocities.org/info/sitebutton.gif" width="88" height="31"></a></li>
         <li><a href="https://yesterweb.org/no-to-web3"><img alt="no-to-web3" src="https://auzziejay.com/images/noweb32.gif" width="88" height="31"></a></li>
         <li><a href="https://uwcur.neocities.org/"><img alt="uwcur" src="http://infinititeam0.weebly.com/uploads/2/4/4/1/24413150/banner1_orig.png" width="88" height="31"></a></li>
         <li><a href="https://www.lainchan.org/"><img alt="lainchan" src="https://lainchan.org/static/lain_banner1.png" width="88" height="31"></a></li>
index 4ca1b66da3f07e1606cca616c467873494c5bda4..e262286d01a0f0675d060d8390784c55d4de0456 100644 (file)
@@ -72,6 +72,13 @@ fn handleClient(parent_allocator: std.mem.Allocator, connection: std.net.Server.
         const target = request.head.target;
         const route = target[1..];
 
+        if (route.len > 256) {
+            status = .bad_request;
+            try send_buffer.appendSlice("Route too long.");
+
+            return;
+        }
+
         std.log.info("Received request to {s}.", .{target});
 
         const is_file = blk: {