From 247fb6d6e935c683e67ecbcc758ccf9c7ea9b029 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sat, 3 Dec 2011 14:57:59 +0100 Subject: [PATCH] Limit search query length to 1000 characters --- pgweb/search/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pgweb/search/views.py b/pgweb/search/views.py index c5377015..54c1a914 100644 --- a/pgweb/search/views.py +++ b/pgweb/search/views.py @@ -116,6 +116,12 @@ def search(request): }) query = request.REQUEST['q'] + # Anti-stefan prevention + if len(query) > 1000: + return render_to_response('search/sitesearch.html', { + 'search_error': "Search term too long.", + }) + # Is the request being paged? if request.REQUEST.has_key('p'): try: -- 2.39.5