32 lines
880 B
Diff
32 lines
880 B
Diff
|
|
From 696a9fb5d042e9d4e8f2ae785374595748078114 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Colin Read <coread@cisco.com>
|
||
|
|
Date: Wed, 1 Aug 2018 17:48:11 +0200
|
||
|
|
Subject: [PATCH 09/13] Fix distdifference
|
||
|
|
|
||
|
|
---
|
||
|
|
python/cracklib.py | 4 ++--
|
||
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/python/cracklib.py b/python/cracklib.py
|
||
|
|
index 9de7e89..f4c98cd 100644
|
||
|
|
--- a/python/cracklib.py
|
||
|
|
+++ b/python/cracklib.py
|
||
|
|
@@ -53,12 +53,12 @@ def distdifferent(old, new, i, j):
|
||
|
|
"""Calculate how different two strings are in terms of the number
|
||
|
|
of character removals, additions, and changes needed to go from one
|
||
|
|
to the other."""
|
||
|
|
- if i == 0 or len(old) <= i:
|
||
|
|
+ if i == 0 or len(old) < i:
|
||
|
|
cval = 0
|
||
|
|
else:
|
||
|
|
cval = old[i - 1]
|
||
|
|
|
||
|
|
- if j == 0 or len(new) <= j:
|
||
|
|
+ if j == 0 or len(new) < j:
|
||
|
|
dval = 0
|
||
|
|
else:
|
||
|
|
dval = new[j - 1]
|
||
|
|
--
|
||
|
|
2.19.1
|
||
|
|
|