changeset 49:27b4391e7df8

Length-limit notes.
author Lewin Bormann <lbo@spheniscida.de>
date Thu, 03 Dec 2020 21:57:41 +0100
parents 6ee4923958f0
children 272fd1c35319
files src/main.rs
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.rs	Thu Dec 03 21:56:22 2020 +0100
+++ b/src/main.rs	Thu Dec 03 21:57:41 2020 +0100
@@ -133,6 +133,13 @@
         note
     };
 
+    // Length-limit notes.
+    if let Some(note) = note.as_ref() {
+        if note.len() > 4096 {
+            return http::bad_request("A note attached to a point may not be longer than 4 KiB.".into());
+        }
+    }
+
     let point = types::GeoPoint {
         lat: lat,
         long: longitude,