61 lines
1.3 KiB
Diff
61 lines
1.3 KiB
Diff
diff -up cracklib-2.9.6/lib/packlib.c.lookup cracklib-2.9.6/lib/packlib.c
|
|
--- cracklib-2.9.6/lib/packlib.c.lookup 2018-10-10 14:19:06.988958835 +0200
|
|
+++ cracklib-2.9.6/lib/packlib.c 2018-11-26 16:04:34.648256614 +0100
|
|
@@ -585,12 +585,11 @@ fprintf(stderr, "look for (%s)\n", strin
|
|
fprintf(stderr, "---- %lu, %lu ----\n", lwm, hwm);
|
|
#endif
|
|
|
|
- middle = lwm + ((hwm - lwm + 1) / 2);
|
|
-
|
|
for (;;)
|
|
{
|
|
int cmp;
|
|
|
|
+ middle = lwm + ((hwm - lwm + 1) / 2);
|
|
|
|
#if DEBUG
|
|
fprintf(stderr, "lwm = %lu, middle = %lu, hwm = %lu\n", lwm, middle, hwm);
|
|
@@ -617,24 +616,28 @@ fprintf(stderr, "look for (%s)\n", strin
|
|
return(middle);
|
|
}
|
|
|
|
- if (middle == hwm)
|
|
- {
|
|
-#if DEBUG
|
|
- fprintf(stderr, "at terminal subdivision, stopping search\n");
|
|
-#endif
|
|
- break;
|
|
- }
|
|
-
|
|
if (cmp < 0)
|
|
{
|
|
- hwm = middle;
|
|
- middle = lwm + ((hwm - lwm ) / 2);
|
|
- }
|
|
+ if (middle == lwm)
|
|
+ {
|
|
+#if DEBUG
|
|
+ fprintf(stderr, "at terminal subdivision from right, stopping search\n");
|
|
+#endif
|
|
+ break;
|
|
+ }
|
|
+ hwm = middle - 1;
|
|
+ }
|
|
else if (cmp > 0)
|
|
{
|
|
- lwm = middle;
|
|
- middle = lwm + ((hwm - lwm + 1) / 2);
|
|
- }
|
|
+ if (middle == hwm)
|
|
+ {
|
|
+#if DEBUG
|
|
+ fprintf(stderr, "at terminal subdivision from left, stopping search\n");
|
|
+#endif
|
|
+ break;
|
|
+ }
|
|
+ lwm = middle + 1;
|
|
+ }
|
|
}
|
|
|
|
return (PW_WORDS(pwp));
|