summaryrefslogtreecommitdiff
path: root/lib/rpmvercmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rpmvercmp.c')
-rw-r--r--lib/rpmvercmp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/rpmvercmp.c b/lib/rpmvercmp.c
index 27969d47e..5e6a1f985 100644
--- a/lib/rpmvercmp.c
+++ b/lib/rpmvercmp.c
@@ -34,6 +34,7 @@ int rpmvercmp(const char * a, const char * b)
/* loop through each version segment of str1 and str2 and compare them */
/*@-branchstate@*/
+/*@-boundsread@*/
while (*one && *two) {
while (*one && !xisalnum(*one)) one++;
while (*two && !xisalnum(*two)) two++;
@@ -56,10 +57,12 @@ int rpmvercmp(const char * a, const char * b)
/* save character at the end of the alpha or numeric segment */
/* so that they can be restored after the comparison */
+/*@-boundswrite@*/
oldch1 = *str1;
*str1 = '\0';
oldch2 = *str2;
*str2 = '\0';
+/*@=boundswrite@*/
/* take care of the case where the two version segments are */
/* different types: one numeric, the other alpha (i.e. empty) */
@@ -88,18 +91,23 @@ int rpmvercmp(const char * a, const char * b)
if (rc) return rc;
/* restore character that was replaced by null above */
+/*@-boundswrite@*/
*str1 = oldch1;
one = str1;
*str2 = oldch2;
two = str2;
+/*@=boundswrite@*/
}
/*@=branchstate@*/
+/*@=boundsread@*/
/* this catches the case where all numeric and alpha segments have */
/* compared identically but the segment sepparating characters were */
/* different */
+/*@-boundsread@*/
if ((!*one) && (!*two)) return 0;
/* whichever version still has characters left over wins */
if (!*one) return -1; else return 1;
+/*@=boundsread@*/
}