Skip to content

Commit

Permalink
Merge pull request #490 from yonjah/isIP-4-fix
Browse files Browse the repository at this point in the history
fixed wrongly approved zero padded ip 4
  • Loading branch information
chriso committed Feb 9, 2016
2 parents ef08e6d + 451d8fe commit 4bd247b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ describe('Validators', function () {
, '256.0.0.0'
, '0.0.0.256'
, '26.0.0.256'
, '0200.200.200.200'
, '200.0200.200.200'
, '200.200.0200.200'
, '200.200.200.0200'
, '::banana'
, 'banana::'
, '::1banana'
Expand Down
2 changes: 1 addition & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;

var ipv4Maybe = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
, ipv6Block = /^[0-9A-F]{1,4}$/i;

var uuid = {
Expand Down

0 comments on commit 4bd247b

Please sign in to comment.