Skip to content

Make IP address regex more strict #267

Description

@fblundun

Right now it looks like:

var IPRegExp = new RegExp('^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$');

The periods match any character where they should only match a period, so "0w0t0g0y" passes where it should fail. The solution is to double escape the periods.

Metadata

Metadata

Labels

category:browserAbout the browser-specific code.type:defectBugs or weaknesses. The issue has to contain steps to reproduce.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions