Skip to content

Commit 8456744

Browse files
committed
Validate advertising id for zero value (#479)
1 parent 9aa1b44 commit 8456744

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

AndroidSDKCore/src/main/java/com/leanplum/internal/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class Constants {
4343
public static final String LEANPLUM_PACKAGE_IDENTIFIER = BuildConfig.LEANPLUM_PACKAGE_IDENTIFIER;
4444
static final String INVALID_MAC_ADDRESS = "02:00:00:00:00:00";
4545
static final String INVALID_MAC_ADDRESS_HASH = "0f607264fc6318a92b9e13c65db7cd3c";
46+
static final String INVALID_UUID = "00000000-0000-0000-0000-000000000000";
4647

4748
/**
4849
* From very old versions of the SDK, leading zeros were stripped from the mac address.

AndroidSDKCore/src/main/java/com/leanplum/internal/Util.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ public static boolean isValidUserId(String userId) {
259259
Log.d(logPrefix + "(sentinel): " + userId);
260260
return false;
261261
}
262+
if (Constants.INVALID_UUID.equals(userId)) {
263+
Log.d(logPrefix + "(zero uuid): " + userId);
264+
return false;
265+
}
262266
if (userId.length() > Constants.MAX_USER_ID_LENGTH) {
263267
Log.d(logPrefix + "(too long): " + userId);
264268
return false;
@@ -279,7 +283,8 @@ public static boolean isValidDeviceId(String deviceId) {
279283
if (deviceId == null || deviceId.isEmpty() ||
280284
Constants.INVALID_ANDROID_ID.equals(deviceId) ||
281285
Constants.INVALID_MAC_ADDRESS_HASH.equals(deviceId) ||
282-
Constants.OLD_INVALID_MAC_ADDRESS_HASH.equals(deviceId)) {
286+
Constants.OLD_INVALID_MAC_ADDRESS_HASH.equals(deviceId) ||
287+
Constants.INVALID_UUID.equals(deviceId)) {
283288
Log.d(logPrefix + "(sentinel): " + deviceId);
284289
return false;
285290
}

0 commit comments

Comments
 (0)