Ensure dumped Calypso LID values are attempted in ascending order
This commit is contained in:
1 parent
79c210cba9
commit
f5fd7d4f77
1 file changed
+15
@@ -2197,6 +2197,18 @@ static bool calypso_dump_candidate_add(calypso_dump_candidate_list_t *list, uint
|
||||
return true;
|
||||
}
|
||||
|
||||
static int calypso_dump_candidate_compare(const void *a, const void *b) {
|
||||
const calypso_dump_lid_candidate_t *left = a;
|
||||
const calypso_dump_lid_candidate_t *right = b;
|
||||
if (left->lid < right->lid) {
|
||||
return -1;
|
||||
}
|
||||
if (left->lid > right->lid) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t calypso_dump_walk_effective_path(const calypso_dump_walk_context_t *ctx, uint16_t *path, size_t path_max) {
|
||||
if (ctx == NULL || path == NULL || path_max == 0) {
|
||||
return 0;
|
||||
@@ -3378,6 +3390,9 @@ static int calypso_dump_process_context(const calypso_select_result_t *selected,
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
}
|
||||
if (candidates.count > 1) {
|
||||
qsort(candidates.items, candidates.count, sizeof(candidates.items[0]), calypso_dump_candidate_compare);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(DEBUG, "Dump context has %zu candidates", candidates.count);
|
||||
|
||||
Reference in new issue
Block a user