From: Josef 'Jeff' Sipek Date: Mon, 27 Jul 2020 15:15:42 +0000 (-0400) Subject: lib-master: Properly compare unit test output strings with expected values X-Git-Tag: 2.3.13~435 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21477aaefd2ae5faad8ccd9ee4cec97f66c496fc;p=thirdparty%2Fdovecot%2Fcore.git lib-master: Properly compare unit test output strings with expected values The I_MIN() mean that only the prefix was getting compared. --- diff --git a/src/lib-master/test-event-stats.c b/src/lib-master/test-event-stats.c index 3699a363b9..7d878596ce 100644 --- a/src/lib-master/test-event-stats.c +++ b/src/lib-master/test-event-stats.c @@ -224,9 +224,13 @@ static bool compare_test_stats_data_line(const char *reference, const char *actu { const char *const *ref_args = t_strsplit(reference, "\t"); const char *const *act_args = t_strsplit(actual, "\t"); - unsigned int max = I_MIN(str_array_length(ref_args), str_array_length(act_args)); + unsigned int max = str_array_length(ref_args); - for(size_t i=0; i < max && *ref_args != NULL; i++) { + /* different lengths imply not equal */ + if (str_array_length(ref_args) != str_array_length(act_args)) + return FALSE; + + for (size_t i = 0; i < max; i++) { if (i > 1 && i < 6) continue; if (*(ref_args[i]) == 'l') { i++;