From fe8f9d73a24b17a37519a0519dca2b20863cace0 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Wed, 25 Apr 2018 14:01:58 -0400
Subject: [PATCH 1/2] Fix incorrect pointer comparisons in nevra validation
Fixes: Coverity #276018
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
modulemd/modulemd-util.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modulemd/modulemd-util.c b/modulemd/modulemd-util.c
index 09eccb6ff08b065f5cc7730ab0411ffd2ca9a6a6..92adaffc2e22857dcc9d65a5ea5b9375835c48d1 100644
--- a/modulemd/modulemd-util.c
+++ b/modulemd/modulemd-util.c
@@ -180,20 +180,20 @@ modulemd_validate_nevra (const gchar *nevra)
* This needs to come from an external source that's kept up to date or
* this will regularly break.
*/
/* Process the "release" tag */
- while (i > 0)
+ while (i >= tmp)
{
if (*i == '-')
{
break;
}
i--;
}
- if (i <= 0)
+ if (i < tmp)
{
/* We hit the start of the string without hitting '-' */
return FALSE;
}
@@ -206,11 +206,11 @@ modulemd_validate_nevra (const gchar *nevra)
{
break;
}
i--;
}
- if (i <= 0)
+ if (i < tmp)
{
/* We hit the start of the string without hitting ':' */
return FALSE;
}
--
2.17.0