api_subscribe: Check for too-long stream names.

(imported from commit 20d94eafeb333a9bc09b6b20093e13fd1b241ea8)
This commit is contained in:
Tim Abbott 2012-10-12 10:45:53 -04:00
parent f9713d5541
commit 091bc48926
1 changed files with 3 additions and 0 deletions

View File

@ -482,6 +482,9 @@ def api_subscribe(request, user_profile):
if "streams" not in request.POST:
return json_error("Missing streams argument.")
streams = simplejson.loads(request.POST.get("streams"))
for stream_name in streams:
if len(stream_name) > 30:
return json_error("Stream name %s too long." % (stream_name,))
res = add_subscriptions_backend(request, user_profile, streams)
return json_success(res)