summaryrefslogtreecommitdiff
path: root/lib/prefix.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 35b679ab90..aa6661d7fb 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -773,8 +773,18 @@ int prefix_cmp(union prefixconstptr up1, union prefixconstptr up2)
if (i)
return i;
- return numcmp(pp1[offset] & maskbit[shift],
- pp2[offset] & maskbit[shift]);
+ /*
+ * At this point offset was the same, if we have shift
+ * that means we still have data to compare, if shift is
+ * 0 then we are at the end of the data structure
+ * and should just return, as that we will be accessing
+ * memory beyond the end of the party zone
+ */
+ if (shift)
+ return numcmp(pp1[offset] & maskbit[shift],
+ pp2[offset] & maskbit[shift]);
+
+ return 0;
}
/*