Skip to content

Commit

Permalink
Forbid unsafe characters in the level selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph-D committed Jul 11, 2013
1 parent a4a3d88 commit 8005917
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions reading_quiz/quiz.sh
Expand Up @@ -171,8 +171,9 @@ if printf '%s\n' "$QUERY" | grep -q '^\(next\|skip\) *$'; then
fi

# Handle answers.
if echo "$QUERY" | grep -v -q '^[][a-zA-Z0-9 ./-_`]\+$'; then
# $QUERY contains non-latin characters, so assume it's an answer.
if echo "$QUERY" | LC_ALL=C grep -vq '^[a-zA-Z0-9 -]\+$'; then
# $QUERY contains non-latin characters or characters unsafe for a
# filename, so assume it's an answer.
check_if_answer "$QUERY"
exit 0
fi
Expand Down

0 comments on commit 8005917

Please sign in to comment.