Skip to content

Commit

Permalink
mbbsd: Check register email address harder
Browse files Browse the repository at this point in the history
The register email address checking is really bad. It only checks for
one and only one '@'.

The codebase already has is_valid_email(), which does a better check.
Use that instead.
  • Loading branch information
wens committed Jul 15, 2022
1 parent 1073120 commit 26b55a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mbbsd/register.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,8 @@ normalize_email(char *email)
{
char *c = strchr(email, '@');

// reject no '@' or multiple '@'
if (c == NULL || c != strrchr(email, '@'))
// reject no '@' or invalid email address
if (!c || !is_valid_email(email))
return false;

// domain tolower
Expand Down

0 comments on commit 26b55a0

Please sign in to comment.