Permalink
Browse files

better handling of input

  • Loading branch information...
1 parent 94dd980 commit 6941db3dbc3583b82cd0a7da14d828630927ef1e @avleen committed Mar 21, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 htdocs/cgi-bin/register.py
@@ -17,11 +17,12 @@ def main():
form = cgi.FieldStorage()
device_id = form.getvalue("deviceid", None)
registration_id = form.getvalue("registrationid", None)
+ if not registration_id or not device_id:
+ return
+
# Sanitize data ftw!
device_id = re.sub('[^A-Za-z0-9_\-]+', '', device_id)
registration_id = re.sub('[^A-Za-z0-9_\-]+', '', registration_id)
- if not registration_id:
- return
make_db_conn()
cur = DB_CONN.cursor()

0 comments on commit 6941db3

Please sign in to comment.