From 4dc3ad296e688e4cc54eb60b9591a8850740f57a 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 62afed086..764f9aa55 100644 --- a/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java @@ -71,7 +71,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 {