frr/0005-test-typelist-power.patch
2020-01-08 12:24:01 +01:00

31 lines
842 B
Diff

diff --git a/tests/lib/test_typelist.h b/tests/lib/test_typelist.h
index f20bbc52d..9039fa8a4 100644
--- a/tests/lib/test_typelist.h
+++ b/tests/lib/test_typelist.h
@@ -98,12 +98,13 @@ static void ts_hash(const char *text, const char *expect)
unsigned i = 0;
uint8_t hash[32];
char hashtext[65];
- uint32_t count;
+ uint32_t swap_count, count;
- count = htonl(list_count(&head));
+ count = list_count(&head);
+ swap_count = htonl(count);
SHA256_Init(&ctx);
- SHA256_Update(&ctx, &count, sizeof(count));
+ SHA256_Update(&ctx, &swap_count, sizeof(swap_count));
frr_each (list, &head, item) {
struct {
@@ -115,7 +115,7 @@ static void ts_hash(const char *text, const char *expect)
};
SHA256_Update(&ctx, &hashitem, sizeof(hashitem));
i++;
- assert(i < count);
+ assert(i <= count);
}
SHA256_Final(hash, &ctx);