]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/prefix.c
Merge pull request #4850 from lkrishnamoor/show_cli
[mirror_frr.git] / lib / prefix.c
index a34921956f180b8936145961ad89b125c59fa4cb..5071ca8201b4f05d01d8d78b0580c03f2170c92a 100644 (file)
@@ -820,8 +820,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;
 }
 
 /*