Skip to content

Commit ce34cd2

Browse files
committed
oval_cmp_evr_string: Make epoch comparison less restrict for dpkg
dpkg by default sets to 0 the epoch if no epoch is present.
1 parent bd49a1f commit ce34cd2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/OVAL/results/oval_cmp_evr_string.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,10 @@ oval_result_t oval_debian_evr_string_cmp(const char *state, const char *sys, ova
408408
parseEVR(a_copy, &a_epoch, &a_version, &a_release);
409409
parseEVR(b_copy, &b_epoch, &b_version, &b_release);
410410

411-
if (!a_epoch || !b_epoch) {
412-
oscap_seterr(OSCAP_EFAMILY_OVAL, "Invalid epoch.");
413-
free(a_copy);
414-
free(b_copy);
415-
return OVAL_RESULT_ERROR;
416-
}
411+
if (!a_epoch)
412+
a_epoch = "0";
413+
if (!b_epoch)
414+
b_epoch = "0";
417415

418416
aux = strtol(a_epoch, NULL, 10);
419417
if (aux < INT_MIN || aux > INT_MAX) {
@@ -453,7 +451,7 @@ oval_result_t oval_debian_evr_string_cmp(const char *state, const char *sys, ova
453451
case OVAL_OPERATION_LESS_THAN_OR_EQUAL:
454452
return ((result <= 0) ? OVAL_RESULT_TRUE : OVAL_RESULT_FALSE);
455453
default:
456-
oscap_seterr(OSCAP_EFAMILY_OVAL, "Invalid type of operation in rpm version comparison: %d.", operation);
454+
oscap_seterr(OSCAP_EFAMILY_OVAL, "Invalid type of operation in dpkg version comparison: %d.", operation);
457455
}
458456

459457
return OVAL_RESULT_ERROR;

0 commit comments

Comments
 (0)