mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 14:42:06 +00:00
tests: fix endian bug in test_typelist
Fix a byte-swapping bug that appeared on big-endian arch but wasn't visible on little-endian runs. Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
6498fc458d
commit
1dc46d1ece
@ -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 +116,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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user