From 8a1ac35c4d9d0d31cefd236f5da469156ba626ef Mon Sep 17 00:00:00 2001 From: Christian Grigis Date: Tue, 9 Feb 2021 18:39:34 +0100 Subject: [PATCH] Ensure zip keyfile has unique entries --- .../ExposureNotificationServiceImpl.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt index 9bfdfed7..86811c4b 100644 --- a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt +++ b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt @@ -445,8 +445,18 @@ class ExposureNotificationServiceImpl(private val context: Context, private val for (entry in zip.entries()) { when (entry.name) { - "export.bin" -> dataEntry = entry - "export.sig" -> sigEntry = entry + "export.bin" -> + if (dataEntry != null) { + throw Exception("Zip archive contains more than one 'export.bin' entry") + } else { + dataEntry = entry + } + "export.sig" -> + if (sigEntry != null) { + throw Exception("Zip archive contains more than one 'export.sig' entry") + } else { + sigEntry = entry + } else -> throw Exception("Unexpected entry in zip archive: ${entry.name}") } }