2353fd3
diff --git a/imap/mailbox.c b/imap/mailbox.c
2353fd3
index e7498c0..8b6f406 100644
2353fd3
--- a/imap/mailbox.c
2353fd3
+++ b/imap/mailbox.c
2353fd3
@@ -5425,7 +5425,7 @@ static int find_files(struct mailbox *mailbox, struct found_uids *files,
2353fd3
     }
2353fd3
 
2353fd3
     /* make sure UIDs are sorted for comparison */
2353fd3
-    qsort(files->found, files->nused, sizeof(unsigned long), sort_found);
2353fd3
+    qsort(files->found, files->nused, sizeof(files->found[0]), sort_found);
2353fd3
 
2353fd3
     strarray_fini(&paths);
2353fd3
 
2353fd3
@@ -6206,7 +6206,7 @@ static int find_annots(struct mailbox *mailbox, struct found_uids *annots)
2353fd3
     if (r) return r;
2353fd3
 
2353fd3
     /* make sure UIDs are sorted for comparison */
2353fd3
-    qsort(annots->found, annots->nused, sizeof(unsigned long), sort_found);
2353fd3
+    qsort(annots->found, annots->nused, sizeof(annots->found[0]), sort_found);
2353fd3
 
2353fd3
     return 0;
2353fd3
 }