[pve-devel] [PATCH qemu-server] limit serial and model and document	their real limits
    Wolfgang Bumiller 
    w.bumiller at proxmox.com
       
    Mon Mar 21 10:58:44 CET 2016
    
    
  
The urlencoded format currently cannot check the real
decoded length, so we limit to an upper bound and document
the real limits. Ideally we'd introduce a decodedLength
schema parameter at some point...
---
 PVE/QemuServer.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fa8f35e..fa364ae 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -620,7 +620,8 @@ my %drivedesc_base = (
 	type => 'string',
 	format => 'urlencoded',
 	format_description => 'serial',
-	description => "The drive's reported serial number, url-encoded.",
+	maxLength => 20*3, # *3 since it's %xx url enoded
+	description => "The drive's reported serial number, url-encoded, up to 20 bytes long.",
 	optional => 1,
     }
 );
@@ -647,7 +648,8 @@ my %model_fmt = (
 	type => 'string',
 	format => 'urlencoded',
 	format_description => 'model',
-	description => "The drive's reported model name, url-encoded.",
+	maxLength => 40*3, # *3 since it's %xx url enoded
+	description => "The drive's reported model name, url-encoded, up to 40 bytes long.",
 	optional => 1,
     },
 );
-- 
2.1.4
    
    
More information about the pve-devel
mailing list