From d8c19424dd81b2da6fa9d0b4c81aa9ea4f3f472d Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 16 Nov 2016 18:27:37 +0100 Subject: [PATCH] fix OOB if hashCdoe is too small --- .../lib/resources/files/ChunkedUploadRemoteFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java b/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java index 393d00a26..c03a18e3d 100644 --- a/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java @@ -69,7 +69,7 @@ protected int uploadFile(OwnCloudClient client) throws IOException { File file = new File(mLocalPath); SharedPreferences sharedPref = mContext.getApplicationContext().getSharedPreferences("com.nextcloud.PREFERENCE_upload", Context.MODE_PRIVATE); - String chunkId = String.valueOf(Math.abs(file.getName().hashCode())).substring(0,8); + String chunkId = String.format("%08d", Math.abs(file.getName().hashCode())); Set successfulChunks = sharedPref.getStringSet(chunkId, new LinkedHashSet()); try {