diff options
author | Yorhel <git@yorhel.nl> | 2018-01-12 15:32:45 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2018-01-12 15:32:47 +0100 |
commit | 0dfcad1921d1f20e51ebb5dc6d07e330367f3631 (patch) | |
tree | 7d421cd1f0666950885dc6e8586641cb63226d76 /lib/VNDBUtil.pm | |
parent | 5c31c5f1629709ce337626cd0dfa216adf3828a4 (diff) |
Don't allow unlikely short GTIN codes
Should fix https://vndb.org/t2520.237
Diffstat (limited to 'lib/VNDBUtil.pm')
-rw-r--r-- | lib/VNDBUtil.pm | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/VNDBUtil.pm b/lib/VNDBUtil.pm index c8cd1bc1..a534856f 100644 --- a/lib/VNDBUtil.pm +++ b/lib/VNDBUtil.pm @@ -23,6 +23,7 @@ sub shorten { # Also 'normalizes' the first argument in place sub gtintype { $_[0] =~ s/[^\d]+//g; + return undef if $_[0] !~ /^[0-9]{10,13}$/; # I've yet to see a UPC code shorter than 10 digits assigned to a game $_[0] = ('0'x(12-length $_[0])) . $_[0] if length($_[0]) < 12; # pad with zeros to GTIN-12 my $c = shift; return undef if $c !~ /^[0-9]{12,13}$/; |